MudBytes
» MUDBytes Community » Codebase Specific » DikuMUD » AnatoliaMUD-3.1.1
Pages: << prev 1, 2, 3, 4 next >>
AnatoliaMUD-3.1.1, need some help
Tyche
Wizard






Group: Members
Posts: 1,343
Joined: May 23, 2006

Go to the bottom of the page Go to the top of the page
#46 id:44277 Posted Mar 21, 2010, 7:43 am

Codelite isn't a compiler. It's an IDE which calls whatever compiler is installed, you set it up to call, or what's bundled with Codelite for the system.
If you are running it on Windows, it's going to call MinGW which is some version of gcc 3.x.
.........................
http://jlsysinc.gotdns.com/ladybug_laugh2.jpghttp://jlsysinc.gotdns.com/teensymud_250x80.pnghttp://jlsysinc.gotdns.com/palin_calendar.jpg
For now we see through a glass, darkly; but then face to face: now I know in part; but then shall I know even as also I am known.


wildmak
Apprentice




Group: Members
Posts: 29
Joined: Mar 15, 2010

Go to the bottom of the page Go to the top of the page
#47 id:44280 Posted Mar 21, 2010, 10:01 am

Am running under Ubuntu 9.10 .... Codelite has still been a useful program .... Mud runs but isn't stable ... now I get to track down buffer overflows .... but at least it is something new to work on and some sort of progress.

jurdendurden
Conjurer






Group: Members
Posts: 219
Joined: Nov 20, 2009

Go to the bottom of the page Go to the top of the page
#48 id:44283 Posted Mar 21, 2010, 11:16 am

I'm glad you got Anatolia to finally run (somewhat) properly! What did you end up changing (you mentioned the if statements we discussed we more easily fixed and you also mentioned that you can re-log in now)?
.........................
Aragond: the Chronicles

wildmak
Apprentice




Group: Members
Posts: 29
Joined: Mar 15, 2010

Go to the bottom of the page Go to the top of the page
#49 id:44286 Posted Mar 21, 2010, 2:40 pm

There were several bits of code like
Code (text):
1
2
3
4
 
ORG_RACE(ch) = race_lookup("human");


that were causing lhand operator errors...

changed to :
Quote:

ORG_RACE(ch) == race_lookup("human");


That solved the login error ... now I'm trying to figure out why quest.c is causing a buffer overflow error.  (at least I think it's in quest.c somewhere, the mud doesn't seem to crash till I type quest list, which calls stuff in that file).

Runter
Wizard






Group: Members
Posts: 1,850
Joined: Jun 1, 2006

Go to the bottom of the page Go to the top of the page
#50 id:44287 Posted Mar 21, 2010, 2:42 pm


wildmak said:
There were several bits of code like
Code (text):
1
2
3
4
 
ORG_RACE(ch) = race_lookup("human");


that were causing lhand operator errors...

changed to :
Quote:

ORG_RACE(ch) == race_lookup("human");


That solved the login error ... now I'm trying to figure out why quest.c is causing a buffer overflow error.  (at least I think it's in quest.c somewhere, the mud doesn't seem to crash till I type quest list, which calls stuff in that file).


That's a fail.    That makes the statement effectually do nothing.    With all due respect, if these are the types of fixes you're doing it's no surprise if the code isn't stable. 

To fix what you just posted you need to manually expand the macro and do "= race_lookup("human");"    as has already been pointed out.
.........................
CoralMud project

For once you have tasted flight Ruby you will walk the earth with your eyes turned skywards,
for there you have been and there you will long to return. --
                                              Leonardo Da Vinci Yukihiro Matsumoto

David Haley
Wizard






Group: Members
Posts: 6,874
Joined: Jun 30, 2007

Go to the bottom of the page Go to the top of the page
#51 id:44291 Posted Mar 21, 2010, 3:47 pm

I have to admit that I don't really understand why you are fixing it like that. The solution for that exact problem has been given very many times already. Not only that, but several times already you have given "fixes" for it, and have been told that they did not work and that you should use the expansion to conditionals. Yet you keep coming back with new and different broken "fixes". Are you unsatisfied with the solution that was given to you? Is it unclear to you? It makes it difficult to help you if you go off doing random (and obviously incorrect) stuff like that despite people trying to help you. If you want us to help you, you need to work with us.
.........................
-- d.c.h --
BabbleMUD Project (custom codebase)
Legends of the Darkstone (head coder)
http://david.the-haleys.org
.........................

wildmak
Apprentice




Group: Members
Posts: 29
Joined: Mar 15, 2010

Go to the bottom of the page Go to the top of the page
#52 id:44298 Posted Mar 21, 2010, 5:19 pm

Just did a clean recompile to make sure that I didn't miss anything in these threads (and yes I missed something on the other posts) .... whether it is correct or not ... both methods do work ....

The if statements , or = to ==  both allow me log back in to a saved character.  I am currently running on the if statements .... apologies for being a headache ...

I don't know enough yet about this to know which method is better(because so far from what I can tell they had the same effect)  (yes, I'm still reading) ... but I do know enough to know that the changing = to == wasn't the cause of the buffer problem that I mentioned that I'm now looking at , as it occurs even with If statements, unless I botched something , which as the problem is fixed I don't think I did this time ...

anatolia.h:2986: error: array type has incomplete element type

Line 2986
Code (text):
1
2
3
extern	const	struct	cmd_type	cmd_table	[];


Extern Const is already defined in interp.h

changed to
Code (text):
1
2
3
//extern	const	struct	cmd_type	cmd_table	[]; --Already Defined in Interp.h


tables.h:40: error: array type has incomplete element type

Code (text):
1
2
3
extern	const	struct	position_type	position_table[];


Moved all Extern const 's from the beginning of the file to the end of the file after the last };


act_comm.c:175: warning: cast from pointer to integer of different size

Code (text):
1
2
3
 for (i = 0; speech[i] != (char) NULL; i++) {


Changed to

Code (text):
1
2
3
 for (i = 0; speech[i] != '\0'; i++) {



act_wiz.c:4950: error: lvalue required as left operand of assignment

Code (text):
1
2
3
ORG_RACE(victim) = race;


Was changed to
Code (text):
1
2
3
4
5
6
if (IS_NPC(victim))
    victim->pIndexData->race = race;
else
    victim->pcdata->race = race;


Next is in Comm.c Line 1918

Code (text):
1
2
3
ORG_RACE(ch) = race;


to

Code (text):
1
2
3
4
5
6
if (IS_NPC(ch))
    ch->pIndexData->race = race;
else
    ch->pcdata->race = race;



Followed by Save.c Line 752

Code (text):
1
2
3
ORG_RACE(ch) = race_lookup("human");


to

Code (text):
1
2
3
4
5
6
if (IS_NPC(ch))
  ch->pIndexData->race = race_lookup("human");
else
  ch->pcdata->race = race_lookup("human");


and

Line  1213

Code (text):
1
2
3
ORG_RACE(ch) = RACE(ch);


to

Code (text):
1
2
3
4
5
6
if (IS_NPC(ch))
  ch->pIndexData->race = RACE(ch);
else
  ch->pcdata->race = RACE(ch);


And in 1512

Code (text):
1
2
3
ORG_RACE(pet) = RACE(pet);


to

Code (text):
1
2
3
4
5
6
if (IS_NPC(pet))
  pet->pIndexData->race = RACE(pet);
else
  pet->pcdata->race = RACE(pet);



Ty again

ATT_Turan
Conjurer




Group: Members
Posts: 154
Joined: Jun 10, 2009

Go to the bottom of the page Go to the top of the page
#53 id:44307 Posted Mar 22, 2010, 12:08 am

I can't quite wrap my head around this...just because two entirely different code statements both compile without errors and allow you to do some things on your MUD for a period of time, you think they are equivalent? And continue to think this even after a number of very knowledgeable and friendly forum members have told you otherwise? I see that you're currently running code with the replaced if statements, but just the fact that you don't know which "fix" is better is troubling.

In C, the assignment operator (=) sets something equal to something else: x = 4 will make the variable x hold the value of 4.

The is equal to operator (==) asks if something is equal to something else: x == 4 will say true if x is 4 and false if x is not 4.

Whatever you have on the left and right sides, these operators can never achieve the same thing - your other fix is wrong, and the fact that it compiles does not make it right. The compiler can only tell you when there is stuff typed in your file that isn't correct C code, it can't tell you whether it does what you want it to do. This is very basic knowledge for C...David's advice that you complete tutorials before trying to fix as complicated a project as a MUD is good advice.

Last edited Mar 22, 2010, 12:11 am by ATT_Turan
wildmak
Apprentice




Group: Members
Posts: 29
Joined: Mar 15, 2010

Go to the bottom of the page Go to the top of the page
#54 id:44321 Posted Mar 22, 2010, 1:12 pm

./lurk on .... Already stated that I missed something in the previous post (and caught it when I went through it all again)  and apologized for being a headache, and that isn't good enough ... Already stated that I am still reading, and learning , and you people continue to attack ....

My next error that I'm running into has nothing to do with the changes made in this thread, but I'll fix it on my own without asking for help here, as yall will just blame it on my lack of coding knowledge...

flumpy
Wizard






Group: Members
Posts: 623
Joined: Mar 27, 2009

Go to the bottom of the page Go to the top of the page
#55 id:44324 Posted Mar 22, 2010, 1:37 pm

Listen, to be honest you need to learn to read the tone here.

No one is attacking you, I think there is just genuine disbelief that you are tackling something so complex when it is clear you do not have a grasp of the basics.

I don't think anyone would discourage you for your laudable aims, I just think you need to spend a few weeks brushing up on the fundamentals before you jump in at the deep end. It's one thing to request help but another when we see someone who just has not done their homework first...

As I said spend a few weeks (yes, weeks, full on weeks) going through some tutorials and get used to the syntax and subtleties of the language and then come back; we really are a helpful bunch but we tend to balk at people who do not seem to have put in the hours...
.........................

GroovyMud - a mud engine written in Java and Groovy

try it out! telnet://zeno.biyg.org:2223


Disclaimer: this project is in alpha, and therefore in heavy development.

Check out GWABS, the desktop battler: from an idea I had on Cambrian House

David Haley
Wizard






Group: Members
Posts: 6,874
Joined: Jun 30, 2007

Go to the bottom of the page Go to the top of the page
#56 id:44326 Posted Mar 22, 2010, 1:43 pm

To be honest, it's not that we/I expect you to be an already competent programmer. Obviously, that would be a bad way to help new programmers. My personal issue was that I found it quite surprising for you to have been given solutions but do something else. If the solutions didn't work or were confusing, you should say so. But it's very hard to help somebody when you have the impression that they're simply not listening to you.
.........................
-- d.c.h --
BabbleMUD Project (custom codebase)
Legends of the Darkstone (head coder)
http://david.the-haleys.org
.........................

Sharmair
Conjurer






Group: Members
Posts: 230
Joined: Nov 9, 2008

Go to the bottom of the page Go to the top of the page
#57 id:44333 Posted Mar 22, 2010, 3:17 pm

First, I would hope you continue to post for help and advice here.  I think the
problems most had was they thought their advice was just being ignored as you
were asking about the same problems even after some form of fix was already
given.  But as you said, you might have missed it, or it just did not sink in right
away.  (looking back, I see some was also incorrect).  You for sure would not
be the first to have had either of those situations.  Frankly, I would like to see
more ask questions here, even if they seem a bit clueless (at least at first).

In a related thread, there was a comment about what compiler to 'believe'.
Different compilers, platforms and settings can result in different sets of warnings
and even errors.  As an example, I do my work on my windows computer using
MSVC and then upload to *nix servers using gcc and there are some warnings
and errors I get on both that I don't see on the other.  I consider the code clean
only after it compiles clean on all the platforms I use.

Ok, I wanted to make a few comments on the conditional operator (lvalue) error.
First of all, a legal lvalue is something that is legal on the left side of an assignment.
As it has been pointed out, it seems that the conditional operator (?:) results in
an rvalue (something that is legal on the right side of an assignment (=) but not
the left) with some compilers and an lvalue with others.  I am not sure if this change
is from some tighter conformity to a standard, or just a side effect of changes in
the way the compiler creates and uses temporary variables (I have some reason to
think this might be the case) though.  You were given a fix where you replaced
the use of the macro with a multi line if statement where you assigned each
target location with the race you wanted to set.  An alternate way you could fix
the macro would be to change it to something like:
Code (c):
1
2
3
#define ORG_RACE(ch) (*(IS_NPC(ch)? &(ch)->pIndexData->race: &(ch)->pcdata->race))

In this case, the conditional is choosing one of two locations (not a value that
could be an rvalue) and then dereferencing that location, resulting in an lvalue.

If you don't want to use the macro on the left side of the assignments, and you
have the coding skill and understanding of the code in question, you can probably
simplify the code in most cases.  As an example, the use in comm.c in nanny has
to do with player creation and ONLY effects players, so you could just use:
Code (c):
1
2
3
ch->pcdata->race = race;

as it will NEVER be an NPC.  Really, about the only place I would think the NPC
case would be used in an assignment (on the left side) would be in mobile OLC.
(even if the pet use in save.c can only be NPC, the loading/saving of a pet
probably should not even be trying to change the prototype mobile's ORG_RACE).

Pages:<< prev 1, 2, 3, 4 next >>
Tags
[+]

Valid XHTML 1.1! Valid CSS!