Jump to content

Can't Create New Towns


Recommended Posts

The Create Town Entrance button seems to do nothing in actual practice, I am using the latest 3D Editor. Meanwhile I could create a town entrance in the same place using the official Spiderweb editor.

I have not made any alterations apart from rearranging the hot-keys. Also touched up G4915.bmp, as explained in the New Windows 3D Editor topic.

Link to comment
Share on other sites

Well, I certainly haven't touched the code; while I wonder how it broke, we obviously need to fix it. I haven't time to really debug this, but here's a rough list of what I would check for:

-Is case 106 in the big switch in handle_action being triggered?

-Is case 22 in the big switch in handle_ter_spot_press being reached?

-In create_town_entry, is a free slot in the town entry list being successfully found?

-Is get_a_number actually returning the entered number?

 

(I'm not sure at what point the tool currently 'does nothing'; whether it's when the button is clicked, after a rectangle has been marked out or what, so this will affect which of my list items actually bear consideration. Also, now that I've looked at the code of create_town_entry I have an urge to rewrite it; it looks functional as it is, just very weird with the user input being sought inside the loop that looks for free slots.)

Link to comment
Share on other sites

Here is the function from the original 3D source code:

void create_town_entry(RECT rect_hit)

{

short x,y;

for (x = 0; x < 8; x++)

if ((current_terrain.exit_dests[x] < 0) || (current_terrain.exit_rects[x].right <= 0)) {

y = get_a_number(856,0,0,scenario.num_towns - 1);

if (cre(y,0,scenario.num_towns - 1,"The town number you gave was out of range. It must be from 0 to the number of towns in the scenario - 1.","",0) == TRUE) return;

if (y >= 0) {

current_terrain.exit_dests[x] = y;

current_terrain.exit_rects[x].top = (short)rect_hit.top;

current_terrain.exit_rects[x].left = (short)rect_hit.left;

current_terrain.exit_rects[x].bottom = (short)rect_hit.bottom;

current_terrain.exit_rects[x].right = (short)rect_hit.right;

}

return;

}

give_error("You can't set more than 8 town entrances in any outdoor section.","",0);

}

 

Here is the current function:

void create_town_entry(RECT rect_hit)

{

short x,y;

for (x = 0; x < 8; x++){

if ((current_terrain.exit_dests[x] < 0) || (current_terrain.exit_rects[x].right <= 0)) {

y = get_a_number(856,0,0,scenario.num_towns - 1);

if(y==-1)

return;//the user cancelled the action

if (cre(y,0,scenario.num_towns - 1,"The town number you gave was out of range. It must be from 0 to the number of towns in the scenario - 1.","",0) == TRUE) return;

if (y >= 0) {

current_terrain.exit_dests[x] = y;

current_terrain.exit_rects[x].top = (short)rect_hit.top;

current_terrain.exit_rects[x].left = (short)rect_hit.left;

current_terrain.exit_rects[x].bottom = (short)rect_hit.bottom;

current_terrain.exit_rects[x].right = (short)rect_hit.right;

}

return;

}

return;

}

give_error("You can't set more than 8 town entrances in any outdoor section.","",0);

}

 

Edit:

I just replaced the new function with the original and the problem was solved.

While I am at it I will insert a Clear All Special Encounters for the outdoors sections.

Link to comment
Share on other sites

That may be it, I don't know. The dialog boxes are a mess, I restored the originals there too.

Edit:

It is only the Create/Edit Town Entrance buttons that are a problem.

The Choose button is in the wrong place, this was fixed with:

LTEXT "0_109",7,179,85,63,13

Clicking on the Choose button still does nothing. This is also true for the load a new town dialog.

 

Link to comment
Share on other sites

Originally Posted By: Dahak
If the value of y has not been determined then how do you know that y == -1 means the user canceled the action?
Presumably the get_a_number() function returns -1 if the user clicks Cancel. Hardly ideal, but it has to indicate this somehow.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...