More taking advantage of the common superclass of cTown and cOutdoors
This commit is contained in:
@@ -755,7 +755,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
change_made = true;
|
change_made = true;
|
||||||
}
|
}
|
||||||
else { // MODE_ROOM_RECT
|
else { // MODE_ROOM_RECT
|
||||||
auto& area_descs = editing_town ? town->area_desc : current_terrain->area_desc;
|
auto& area_descs = cur_area->area_desc;
|
||||||
auto iter = std::find_if(area_descs.begin(), area_descs.end(), [](const info_rect_t& r) {
|
auto iter = std::find_if(area_descs.begin(), area_descs.end(), [](const info_rect_t& r) {
|
||||||
return r.right == 0;
|
return r.right == 0;
|
||||||
});
|
});
|
||||||
@@ -776,13 +776,12 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
case MODE_SET_WANDER_POINTS:
|
case MODE_SET_WANDER_POINTS:
|
||||||
if(mouse_button_held)
|
if(mouse_button_held)
|
||||||
break;
|
break;
|
||||||
if(!editing_town) {
|
|
||||||
current_terrain->wandering_locs[mode_count - 1].x = spot_hit.x;
|
|
||||||
current_terrain->wandering_locs[mode_count - 1].y = spot_hit.y;
|
|
||||||
}
|
|
||||||
if(editing_town) {
|
if(editing_town) {
|
||||||
town->wandering_locs[mode_count - 1].x = spot_hit.x;
|
town->wandering_locs[mode_count - 1].x = spot_hit.x;
|
||||||
town->wandering_locs[mode_count - 1].y = spot_hit.y;
|
town->wandering_locs[mode_count - 1].y = spot_hit.y;
|
||||||
|
} else {
|
||||||
|
current_terrain->wandering_locs[mode_count - 1].x = spot_hit.x;
|
||||||
|
current_terrain->wandering_locs[mode_count - 1].y = spot_hit.y;
|
||||||
}
|
}
|
||||||
mode_count--;
|
mode_count--;
|
||||||
switch(mode_count) {
|
switch(mode_count) {
|
||||||
@@ -927,26 +926,26 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
mouse_button_held = true;
|
mouse_button_held = true;
|
||||||
break;
|
break;
|
||||||
case MODE_TOGGLE_SPECIAL_DOT:
|
case MODE_TOGGLE_SPECIAL_DOT:
|
||||||
if(!editing_town){
|
if(editing_town){
|
||||||
|
make_field_type(spot_hit.x, spot_hit.y, SPECIAL_SPOT);
|
||||||
|
mouse_button_held = true;
|
||||||
|
} else {
|
||||||
if(!mouse_button_held)
|
if(!mouse_button_held)
|
||||||
mode_count = !current_terrain->special_spot[spot_hit.x][spot_hit.y];
|
mode_count = !current_terrain->special_spot[spot_hit.x][spot_hit.y];
|
||||||
current_terrain->special_spot[spot_hit.x][spot_hit.y] = mode_count;
|
current_terrain->special_spot[spot_hit.x][spot_hit.y] = mode_count;
|
||||||
mouse_button_held = true;
|
mouse_button_held = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
make_field_type(spot_hit.x, spot_hit.y, SPECIAL_SPOT);
|
|
||||||
mouse_button_held = true;
|
|
||||||
break;
|
break;
|
||||||
case MODE_TOGGLE_ROAD:
|
case MODE_TOGGLE_ROAD:
|
||||||
if(!editing_town){
|
if(editing_town){
|
||||||
|
make_field_type(spot_hit.x, spot_hit.y, SPECIAL_ROAD);
|
||||||
|
mouse_button_held = true;
|
||||||
|
} else {
|
||||||
if(!mouse_button_held)
|
if(!mouse_button_held)
|
||||||
mode_count = !current_terrain->roads[spot_hit.x][spot_hit.y];
|
mode_count = !current_terrain->roads[spot_hit.x][spot_hit.y];
|
||||||
current_terrain->roads[spot_hit.x][spot_hit.y] = mode_count;
|
current_terrain->roads[spot_hit.x][spot_hit.y] = mode_count;
|
||||||
mouse_button_held = true;
|
mouse_button_held = true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
make_field_type(spot_hit.x, spot_hit.y, SPECIAL_ROAD);
|
|
||||||
mouse_button_held = true;
|
|
||||||
break;
|
break;
|
||||||
case MODE_CLEAR_FIELDS:
|
case MODE_CLEAR_FIELDS:
|
||||||
for(int i = 8; i <= SPECIAL_ROAD; i++)
|
for(int i = 8; i <= SPECIAL_ROAD; i++)
|
||||||
@@ -958,9 +957,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
mouse_button_held = true;
|
mouse_button_held = true;
|
||||||
break;
|
break;
|
||||||
case MODE_EYEDROPPER:
|
case MODE_EYEDROPPER:
|
||||||
if(editing_town)
|
set_new_terrain(cur_area->terrain(spot_hit.x,spot_hit.y));
|
||||||
set_new_terrain(town->terrain(spot_hit.x,spot_hit.y));
|
|
||||||
else set_new_terrain(current_terrain->terrain[spot_hit.x][spot_hit.y]);
|
|
||||||
overall_mode = MODE_DRAWING;
|
overall_mode = MODE_DRAWING;
|
||||||
break;
|
break;
|
||||||
case MODE_PLACE_SAME_ITEM:
|
case MODE_PLACE_SAME_ITEM:
|
||||||
@@ -984,9 +981,9 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
break;
|
break;
|
||||||
case MODE_EDIT_SIGN: //edit sign
|
case MODE_EDIT_SIGN: //edit sign
|
||||||
{
|
{
|
||||||
auto& signs = editing_town ? town->sign_locs : current_terrain->sign_locs;
|
auto& signs = cur_area->sign_locs;
|
||||||
auto iter = std::find(signs.begin(), signs.end(), spot_hit);
|
auto iter = std::find(signs.begin(), signs.end(), spot_hit);
|
||||||
short picture = scenario.ter_types[editing_town ? town->terrain(spot_hit.x,spot_hit.y) : current_terrain->terrain[spot_hit.x][spot_hit.y]].picture;
|
short picture = scenario.ter_types[cur_area->terrain(spot_hit.x,spot_hit.y)].picture;
|
||||||
if(iter != signs.end()) {
|
if(iter != signs.end()) {
|
||||||
edit_sign(*iter, iter - signs.begin(), picture);
|
edit_sign(*iter, iter - signs.begin(), picture);
|
||||||
} else {
|
} else {
|
||||||
@@ -1010,7 +1007,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
break;
|
break;
|
||||||
case MODE_COPY_SPECIAL: //copy special
|
case MODE_COPY_SPECIAL: //copy special
|
||||||
{
|
{
|
||||||
auto& specials = editing_town ? town->special_locs : current_terrain->special_locs;
|
auto& specials = cur_area->special_locs;
|
||||||
auto iter = std::find_if(town->special_locs.begin(), town->special_locs.end(), [](const spec_loc_t& loc) {
|
auto iter = std::find_if(town->special_locs.begin(), town->special_locs.end(), [](const spec_loc_t& loc) {
|
||||||
return loc == spot_hit && loc.spec >= 0;
|
return loc == spot_hit && loc.spec >= 0;
|
||||||
});
|
});
|
||||||
@@ -1027,7 +1024,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
cChoiceDlog("not-at-edge").show();
|
cChoiceDlog("not-at-edge").show();
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
auto& specials = editing_town ? town->special_locs : current_terrain->special_locs;
|
auto& specials = cur_area->special_locs;
|
||||||
for(short x = 0; x <= specials.size(); x++) {
|
for(short x = 0; x <= specials.size(); x++) {
|
||||||
if(x == specials.size())
|
if(x == specials.size())
|
||||||
specials.emplace_back(-1,-1,-1);
|
specials.emplace_back(-1,-1,-1);
|
||||||
@@ -1042,7 +1039,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
break;
|
break;
|
||||||
case MODE_ERASE_SPECIAL: //erase special
|
case MODE_ERASE_SPECIAL: //erase special
|
||||||
{
|
{
|
||||||
auto& specials = editing_town ? town->special_locs : current_terrain->special_locs;
|
auto& specials = cur_area->special_locs;
|
||||||
for(short x = 0; x < specials.size(); x++)
|
for(short x = 0; x < specials.size(); x++)
|
||||||
if(specials[x] == spot_hit && specials[x].spec >= 0) {
|
if(specials[x] == spot_hit && specials[x].spec >= 0) {
|
||||||
specials[x] = {-1,-1};
|
specials[x] = {-1,-1};
|
||||||
@@ -1168,6 +1165,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
|||||||
mouse_button_held = true;
|
mouse_button_held = true;
|
||||||
}
|
}
|
||||||
auto max_dim = cur_area->max_dim - 5;
|
auto max_dim = cur_area->max_dim - 5;
|
||||||
|
// This allows you to see a strip of terrain from the adjacent sector when editing outdoors
|
||||||
if(!editing_town) max_dim++;
|
if(!editing_town) max_dim++;
|
||||||
if((the_point.in(border_rect[2])) && (cen_y < max_dim)) {
|
if((the_point.in(border_rect[2])) && (cen_y < max_dim)) {
|
||||||
cen_y++;
|
cen_y++;
|
||||||
@@ -1822,11 +1820,11 @@ void change_rect_terrain(rectangle r,ter_num_t terrain_type,short probability,bo
|
|||||||
void flood_fill_terrain(location start, ter_num_t terrain_type) {
|
void flood_fill_terrain(location start, ter_num_t terrain_type) {
|
||||||
static const int dx[4] = {0, 1, 0, -1};
|
static const int dx[4] = {0, 1, 0, -1};
|
||||||
static const int dy[4] = {-1, 0, 1, 0};
|
static const int dy[4] = {-1, 0, 1, 0};
|
||||||
ter_num_t to_replace = editing_town ? town->terrain(start.x, start.y) : current_terrain->terrain[start.x][start.y];
|
cArea* cur_area = get_current_area();
|
||||||
|
ter_num_t to_replace = cur_area->terrain(start.x, start.y);
|
||||||
std::stack<location> to_visit;
|
std::stack<location> to_visit;
|
||||||
std::set<location, loc_compare> visited;
|
std::set<location, loc_compare> visited;
|
||||||
to_visit.push(start);
|
to_visit.push(start);
|
||||||
cArea* cur_area = get_current_area();
|
|
||||||
|
|
||||||
while(!to_visit.empty()) {
|
while(!to_visit.empty()) {
|
||||||
location this_loc = to_visit.top();
|
location this_loc = to_visit.top();
|
||||||
@@ -1895,7 +1893,7 @@ static ter_num_t find_object_part(unsigned char num, short x, short y, ter_num_t
|
|||||||
|
|
||||||
bool terrain_matches(unsigned char x, unsigned char y, ter_num_t ter) {
|
bool terrain_matches(unsigned char x, unsigned char y, ter_num_t ter) {
|
||||||
ter_num_t ter2;
|
ter_num_t ter2;
|
||||||
if(editing_town) ter2 = town->terrain(x,y); else ter2 = current_terrain->terrain[x][y];
|
ter2 = get_current_area()->terrain(x,y);
|
||||||
if(ter2 == ter) return true;
|
if(ter2 == ter) return true;
|
||||||
if(scenario.ter_types[ter2].ground_type != scenario.ter_types[ter].ground_type)
|
if(scenario.ter_types[ter2].ground_type != scenario.ter_types[ter].ground_type)
|
||||||
return false;
|
return false;
|
||||||
@@ -1948,7 +1946,7 @@ void set_terrain(location l,ter_num_t terrain_type) {
|
|||||||
for(int x = -1; x <= 1; x++) {
|
for(int x = -1; x <= 1; x++) {
|
||||||
for(int y = -1; y <= 1; y++) {
|
for(int y = -1; y <= 1; y++) {
|
||||||
location l3(l.x+x,l.y+y);
|
location l3(l.x+x,l.y+y);
|
||||||
ter_num_t ter_there = editing_town ? town->terrain(l3.x,l3.y) : current_terrain->terrain[l3.x][l3.y];
|
ter_num_t ter_there = cur_area->terrain(l3.x,l3.y);
|
||||||
unsigned int ground_there = scenario.ter_types[ter_there].ground_type;
|
unsigned int ground_there = scenario.ter_types[ter_there].ground_type;
|
||||||
if(ground_there != main_ground && ground_there != trim_ground) {
|
if(ground_there != main_ground && ground_there != trim_ground) {
|
||||||
ter_num_t new_ter = scenario.get_ter_from_ground(trim_ground);
|
ter_num_t new_ter = scenario.get_ter_from_ground(trim_ground);
|
||||||
@@ -2017,7 +2015,7 @@ void adjust_space(location l) {
|
|||||||
store_ter[dx+1][dy+1] = off_map;
|
store_ter[dx+1][dy+1] = off_map;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
store_ter[dx+1][dy+1] = editing_town ? town->terrain(x,y) : current_terrain->terrain[x][y];
|
store_ter[dx+1][dy+1] = cur_area->terrain(x,y);
|
||||||
cTerrain& ter_type = scenario.ter_types[store_ter[dx+1][dy+1]];
|
cTerrain& ter_type = scenario.ter_types[store_ter[dx+1][dy+1]];
|
||||||
store_ter2[dx+1][dy+1] = ter_type.trim_ter;
|
store_ter2[dx+1][dy+1] = ter_type.trim_ter;
|
||||||
store_ground[dx+1][dy+1] = ter_type.ground_type;
|
store_ground[dx+1][dy+1] = ter_type.ground_type;
|
||||||
@@ -2143,7 +2141,7 @@ void place_edit_special(location loc) {
|
|||||||
cChoiceDlog("not-at-edge").show();
|
cChoiceDlog("not-at-edge").show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto& specials = editing_town ? town->special_locs : current_terrain->special_locs;
|
auto& specials = get_current_area()->special_locs;
|
||||||
for(short i = 0; i < specials.size(); i++)
|
for(short i = 0; i < specials.size(); i++)
|
||||||
if(specials[i] == loc && specials[i].spec >= 0) {
|
if(specials[i] == loc && specials[i].spec >= 0) {
|
||||||
edit_spec_enc(specials[i].spec, editing_town ? 2 : 1, nullptr);
|
edit_spec_enc(specials[i].spec, editing_town ? 2 : 1, nullptr);
|
||||||
@@ -2169,7 +2167,7 @@ void set_special(location spot_hit) {
|
|||||||
cChoiceDlog("not-at-edge").show();
|
cChoiceDlog("not-at-edge").show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto& specials = editing_town ? town->special_locs : current_terrain->special_locs;
|
auto& specials = get_current_area()->special_locs;
|
||||||
for(short x = 0; x < specials.size(); x++)
|
for(short x = 0; x < specials.size(); x++)
|
||||||
if(specials[x] == spot_hit && specials[x].spec >= 0) {
|
if(specials[x] == spot_hit && specials[x].spec >= 0) {
|
||||||
int spec = edit_special_num(editing_town ? 2 : 1,specials[x].spec);
|
int spec = edit_special_num(editing_town ? 2 : 1,specials[x].spec);
|
||||||
|
@@ -283,7 +283,7 @@ static std::vector<short> get_small_icons(location at, ter_num_t t_to_draw) {
|
|||||||
icons.push_back(ter_small_i);
|
icons.push_back(ter_small_i);
|
||||||
|
|
||||||
if(is_special(at.x, at.y)) {
|
if(is_special(at.x, at.y)) {
|
||||||
std::vector<spec_loc_t>& spec_list = editing_town ? town->special_locs : current_terrain->special_locs;
|
std::vector<spec_loc_t>& spec_list = get_current_area()->special_locs;
|
||||||
int num_spec = std::count_if(spec_list.begin(), spec_list.end(), [at](spec_loc_t which) {
|
int num_spec = std::count_if(spec_list.begin(), spec_list.end(), [at](spec_loc_t which) {
|
||||||
return which.spec >= 0 && which.x == at.x && which.y == at.y;
|
return which.spec >= 0 && which.x == at.x && which.y == at.y;
|
||||||
});
|
});
|
||||||
@@ -764,9 +764,11 @@ void draw_terrain(){
|
|||||||
which_pt.x = cen_x + q - 4;
|
which_pt.x = cen_x + q - 4;
|
||||||
which_pt.y =cen_y + r - 4;
|
which_pt.y =cen_y + r - 4;
|
||||||
|
|
||||||
if(!editing_town) {
|
|
||||||
for(short i = 0; i < scenario.boats.size(); i++) {
|
for(short i = 0; i < scenario.boats.size(); i++) {
|
||||||
if(scenario.boats[i].which_town == 200 &&
|
if(editing_town && scenario.boats[i].which_town == cur_town &&
|
||||||
|
scenario.boats[i].loc == which_pt)
|
||||||
|
rect_draw_some_item(vehicle_gworld,boat_rect,mainPtr,destrec,sf::BlendAlpha);
|
||||||
|
if(!editing_town && scenario.boats[i].which_town == 200 &&
|
||||||
scenario.boats[i].sector == cur_out &&
|
scenario.boats[i].sector == cur_out &&
|
||||||
scenario.boats[i].loc == which_pt)
|
scenario.boats[i].loc == which_pt)
|
||||||
rect_draw_some_item(vehicle_gworld,boat_rect,mainPtr,destrec,sf::BlendAlpha);
|
rect_draw_some_item(vehicle_gworld,boat_rect,mainPtr,destrec,sf::BlendAlpha);
|
||||||
@@ -775,29 +777,17 @@ void draw_terrain(){
|
|||||||
for(short i = 0; i < scenario.horses.size(); i++) {
|
for(short i = 0; i < scenario.horses.size(); i++) {
|
||||||
source_rect = boat_rect;
|
source_rect = boat_rect;
|
||||||
source_rect.offset(0,36);
|
source_rect.offset(0,36);
|
||||||
if(scenario.horses[i].which_town == 200 &&
|
if(editing_town && scenario.horses[i].which_town == cur_town &&
|
||||||
|
scenario.horses[i].loc == which_pt)
|
||||||
|
rect_draw_some_item(vehicle_gworld,source_rect,mainPtr,destrec,sf::BlendAlpha);
|
||||||
|
if(!editing_town && scenario.horses[i].which_town == 200 &&
|
||||||
scenario.horses[i].sector == cur_out &&
|
scenario.horses[i].sector == cur_out &&
|
||||||
scenario.horses[i].loc == which_pt)
|
scenario.horses[i].loc == which_pt)
|
||||||
rect_draw_some_item(vehicle_gworld,source_rect,mainPtr,destrec,sf::BlendAlpha);
|
rect_draw_some_item(vehicle_gworld,source_rect,mainPtr,destrec,sf::BlendAlpha);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(editing_town) {
|
if(editing_town) {
|
||||||
for(short i = 0; i < scenario.boats.size(); i++) {
|
|
||||||
if(scenario.boats[i].which_town == cur_town &&
|
|
||||||
scenario.boats[i].loc == which_pt)
|
|
||||||
rect_draw_some_item(vehicle_gworld,boat_rect,mainPtr,destrec,sf::BlendAlpha);
|
|
||||||
|
|
||||||
}
|
|
||||||
for(short i = 0; i < scenario.horses.size(); i++) {
|
|
||||||
source_rect = boat_rect;
|
|
||||||
source_rect.offset(0,36);
|
|
||||||
if(scenario.horses[i].which_town == cur_town &&
|
|
||||||
scenario.horses[i].loc == which_pt)
|
|
||||||
rect_draw_some_item(vehicle_gworld,source_rect,mainPtr,destrec,sf::BlendAlpha);
|
|
||||||
|
|
||||||
}
|
|
||||||
if(is_field_type(cen_x + q - 4,cen_y + r - 4, FIELD_WEB)) {
|
if(is_field_type(cen_x + q - 4,cen_y + r - 4, FIELD_WEB)) {
|
||||||
from_rect = calc_rect(5,0);
|
from_rect = calc_rect(5,0);
|
||||||
rect_draw_some_item(fields_gworld,from_rect,mainPtr,destrec,sf::BlendAlpha);
|
rect_draw_some_item(fields_gworld,from_rect,mainPtr,destrec,sf::BlendAlpha);
|
||||||
@@ -919,18 +909,18 @@ void draw_terrain(){
|
|||||||
|
|
||||||
clip_rect(mainPtr,clipping_rect);
|
clip_rect(mainPtr,clipping_rect);
|
||||||
|
|
||||||
|
// draw info rects
|
||||||
|
for(auto& area_desc : get_current_area()->area_desc)
|
||||||
|
if(area_desc.left > 0) {
|
||||||
|
draw_rect.left = 22 + 28 * (area_desc.left - cen_x + 4);
|
||||||
|
draw_rect.right = 22 + 28 * (area_desc.right - cen_x + 4);
|
||||||
|
draw_rect.top = 24 + 36 * (area_desc.top - cen_y + 4);
|
||||||
|
draw_rect.bottom = 24 + 36 * (area_desc.bottom - cen_y + 4);
|
||||||
|
draw_rect.inset(-10, -13);
|
||||||
|
draw_rect.offset(TER_RECT_UL_X, TER_RECT_UL_Y);
|
||||||
|
frame_rect(mainPtr, draw_rect, Colours::RED);
|
||||||
|
}
|
||||||
if(editing_town) {
|
if(editing_town) {
|
||||||
// draw info rects
|
|
||||||
for(short i = 0; i < town->area_desc.size(); i++)
|
|
||||||
if(town->area_desc[i].left > 0) {
|
|
||||||
draw_rect.left = 22 + 28 * (town->area_desc[i].left - cen_x + 4);
|
|
||||||
draw_rect.right = 22 + 28 * (town->area_desc[i].right - cen_x + 4);
|
|
||||||
draw_rect.top = 24 + 36 * (town->area_desc[i].top - cen_y + 4);
|
|
||||||
draw_rect.bottom = 24 + 36 * (town->area_desc[i].bottom - cen_y + 4);
|
|
||||||
draw_rect.inset(-10, -13);
|
|
||||||
draw_rect.offset(TER_RECT_UL_X,TER_RECT_UL_Y);
|
|
||||||
frame_rect(mainPtr, draw_rect, Colours::RED);
|
|
||||||
}
|
|
||||||
// draw border rect
|
// draw border rect
|
||||||
draw_rect.left = 21 + 28 * (town->in_town_rect.left - cen_x + 4);
|
draw_rect.left = 21 + 28 * (town->in_town_rect.left - cen_x + 4);
|
||||||
draw_rect.right = 21 + 28 * (town->in_town_rect.right - cen_x + 4);
|
draw_rect.right = 21 + 28 * (town->in_town_rect.right - cen_x + 4);
|
||||||
@@ -940,19 +930,6 @@ void draw_terrain(){
|
|||||||
draw_rect.offset(TER_RECT_UL_X, TER_RECT_UL_Y);
|
draw_rect.offset(TER_RECT_UL_X, TER_RECT_UL_Y);
|
||||||
frame_rect(mainPtr, draw_rect, sf::Color::White);
|
frame_rect(mainPtr, draw_rect, sf::Color::White);
|
||||||
}
|
}
|
||||||
if(!editing_town) {
|
|
||||||
// draw info rects
|
|
||||||
for(short i = 0; i < current_terrain->area_desc.size(); i++)
|
|
||||||
if(current_terrain->area_desc[i].left > 0) {
|
|
||||||
draw_rect.left = 22 + 28 * (current_terrain->area_desc[i].left - cen_x + 4);
|
|
||||||
draw_rect.right = 22 + 28 * (current_terrain->area_desc[i].right - cen_x + 4);
|
|
||||||
draw_rect.top = 24 + 36 * (current_terrain->area_desc[i].top - cen_y + 4);
|
|
||||||
draw_rect.bottom = 24 + 36 * (current_terrain->area_desc[i].bottom - cen_y + 4);
|
|
||||||
draw_rect.inset(-10, -13);
|
|
||||||
draw_rect.offset(TER_RECT_UL_X, TER_RECT_UL_Y);
|
|
||||||
frame_rect(mainPtr, draw_rect, Colours::RED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clip_rect(mainPtr, terrain_rect);
|
clip_rect(mainPtr, terrain_rect);
|
||||||
|
|
||||||
small_any_drawn = false;
|
small_any_drawn = false;
|
||||||
@@ -981,7 +958,7 @@ void draw_terrain(){
|
|||||||
for(short r = yMin; r < yMax; r++) {
|
for(short r = yMin; r < yMax; r++) {
|
||||||
if(q - xMin < 0 || q - xMin >= max_dim || r - yMin < 0 || r - yMin >= max_dim)
|
if(q - xMin < 0 || q - xMin >= max_dim || r - yMin < 0 || r - yMin >= max_dim)
|
||||||
t_to_draw = 90;
|
t_to_draw = 90;
|
||||||
else t_to_draw = editing_town ? town->terrain(q,r) : current_terrain->terrain[q][r];
|
else t_to_draw = get_current_area()->terrain(q,r);
|
||||||
draw_one_tiny_terrain_spot(q-xMin,r-yMin,t_to_draw,size,is_road(q,r));
|
draw_one_tiny_terrain_spot(q-xMin,r-yMin,t_to_draw,size,is_road(q,r));
|
||||||
small_what_drawn[q][r] = t_to_draw;
|
small_what_drawn[q][r] = t_to_draw;
|
||||||
}
|
}
|
||||||
@@ -1547,14 +1524,9 @@ void set_string(std::string string,std::string string2) {
|
|||||||
bool is_special(short i,short j) {
|
bool is_special(short i,short j) {
|
||||||
location check(i,j);
|
location check(i,j);
|
||||||
|
|
||||||
if(editing_town)
|
for(auto loc : get_current_area()->special_locs)
|
||||||
for(short k = 0; k < town->special_locs.size(); k++)
|
if(loc == check && loc.spec >= 0)
|
||||||
if(town->special_locs[k] == check && town->special_locs[k].spec >= 0)
|
return true;
|
||||||
return true;
|
|
||||||
if(!editing_town)
|
|
||||||
for(short k = 0; k < current_terrain->special_locs.size(); k++)
|
|
||||||
if(current_terrain->special_locs[k] == check && current_terrain->special_locs[k].spec >= 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
#include "fileio/resmgr/res_dialog.hpp"
|
#include "fileio/resmgr/res_dialog.hpp"
|
||||||
|
|
||||||
extern short cen_x, cen_y, overall_mode;
|
extern short cen_x, cen_y, overall_mode;
|
||||||
extern bool mouse_button_held,editing_town,change_made;
|
extern bool mouse_button_held,change_made;
|
||||||
extern short cur_viewing_mode;
|
extern short cur_viewing_mode;
|
||||||
extern cTown* town;
|
extern cTown* town;
|
||||||
extern short mode_count,to_create,cur_town;
|
extern short mode_count,to_create,cur_town;
|
||||||
|
Reference in New Issue
Block a user