Click here to Skip to main content
15,918,193 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I run adb or fastboot command in the folder location? Pin
Pete O'Hanlon17-Jan-18 8:59
mvePete O'Hanlon17-Jan-18 8:59 
GeneralRe: How do I run adb or fastboot command in the folder location? Pin
Richard MacCutchan17-Jan-18 23:26
mveRichard MacCutchan17-Jan-18 23:26 
GeneralRe: How do I run adb or fastboot command in the folder location? Pin
Member 1362111717-Jan-18 11:54
Member 1362111717-Jan-18 11:54 
QuestionError: Object reference not set to an instance of an object in C# Pin
Member 1030297116-Jan-18 13:52
Member 1030297116-Jan-18 13:52 
AnswerRe: Error: Object reference not set to an instance of an object in C# Pin
OriginalGriff16-Jan-18 21:12
mveOriginalGriff16-Jan-18 21:12 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Member 1030297117-Jan-18 2:47
Member 1030297117-Jan-18 2:47 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Pete O'Hanlon17-Jan-18 2:55
mvePete O'Hanlon17-Jan-18 2:55 
AnswerRe: Error: Object reference not set to an instance of an object in C# Pin
Ralf Meier16-Jan-18 21:14
mveRalf Meier16-Jan-18 21:14 
AnswerRe: Error: Object reference not set to an instance of an object in C# Pin
V.16-Jan-18 22:06
professionalV.16-Jan-18 22:06 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Member 1030297117-Jan-18 3:00
Member 1030297117-Jan-18 3:00 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
F-ES Sitecore17-Jan-18 4:05
professionalF-ES Sitecore17-Jan-18 4:05 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
Pete O'Hanlon17-Jan-18 4:41
mvePete O'Hanlon17-Jan-18 4:41 
GeneralRe: Error: Object reference not set to an instance of an object in C# Pin
V.18-Jan-18 3:25
professionalV.18-Jan-18 3:25 
QuestionException raised at wpf designer level Pin
abboudi_ammar16-Jan-18 7:35
abboudi_ammar16-Jan-18 7:35 
QuestionHow to convert a query to lambda based Pin
Mou_kol16-Jan-18 1:43
Mou_kol16-Jan-18 1:43 
AnswerRe: How to convert a query to lambda based Pin
OriginalGriff16-Jan-18 1:52
mveOriginalGriff16-Jan-18 1:52 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol16-Jan-18 3:50
Mou_kol16-Jan-18 3:50 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol24-Jan-18 0:26
Mou_kol24-Jan-18 0:26 
GeneralRe: How to convert a query to lambda based Pin
OriginalGriff24-Jan-18 0:44
mveOriginalGriff24-Jan-18 0:44 
AnswerRe: How to convert a query to lambda based Pin
Richard Deeming16-Jan-18 3:03
mveRichard Deeming16-Jan-18 3:03 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol16-Jan-18 3:50
Mou_kol16-Jan-18 3:50 
GeneralRe: How to convert a query to lambda based Pin
Mou_kol24-Jan-18 0:35
Mou_kol24-Jan-18 0:35 
Questioncontour plot in visual studio Pin
Member 1362407415-Jan-18 6:27
Member 1362407415-Jan-18 6:27 
AnswerRe: contour plot in visual studio Pin
Richard MacCutchan15-Jan-18 7:15
mveRichard MacCutchan15-Jan-18 7:15 
QuestionI got the error that: Not all code paths return a value Pin
irisemars15-Jan-18 2:15
irisemars15-Jan-18 2:15 
Hey all,

So I'm coding on some random dungeon-gen, and up until now it's being going great.

I am getting the error Not all code paths return a value I looked into the error, tweaked my code a little and I'm still not making any progress. Let me post my code.


Quote:
using UnityEngine;
using System.Collections.Generic;

public class DTileMap
{
protected class DRoom
{
public int left;
public int top;
public int width;
public int height;

public int right {
get {return left + width - 1;} }

public int bottom {
get { return top + height - 1; }
}

public bool CollidesWith(DRoom other) {
if( left > other.right-1 )
return false;

if( top > other.bottom-1 )
return false;

if( right < other.left+1 )
return false;

if( bottom < other.top+1 )
return false;

return true;
}

}

int size_x;
int size_y;

int[,] map_data;

List<droom> rooms;

public DTileMap (int size_x, int size_y)
{
this.size_x = size_x;
this.size_y = size_y;

rooms = new List<droom> ();

map_data = new int[size_x, size_y];
for (int i=0; i < 30; i++) {
int rsx = Random.Range (4,8);
int rsy = Random.Range (4,8);

DRoom r = new DRoom();
r.left = Random.Range(0, size_x - rsx);
r.top = Random.Range(0, size_y-rsy);
r.width = rsx;
r.height = rsy;

if(!RoomCollides(r)){
rooms.Add (r);
MakeRoom(r);
}
}
}

bool RoomCollides(DRoom r)
{
foreach (DRoom r2 in rooms)
{
if(r.CollidesWith(r2))
{
return true;
}
}
}

public int GetTileAt(int x, int y){
return map_data [x, y];
}

void MakeRoom(DRoom r)
{
for (int x=0; x < r.width; x++)
{
for (int y=0; y < r.height; y++)
{
if(x==0 || x == r.width -1 || y==0 || y==r.height -1)
{
map_data[r.left+x, r.top+y] = 3;
}
else

{
map_data [r.left + x, r.top + y] = 1;
}
}
}
}
}

// Id's
// 0 = Void
// 1 = Floor
// 2 = Random
// 3 = Wall

Now, the error code is pointing towards line 69, but I check all of my value on lines 21 - 34.

If you need any extra information, let me know. I've tried to figure this out, but I'm stumped...

Thanks in advance!

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.