continue to add methods to check bounds, to be continued,
+ try to do not add empty strings in encounter message + minimap: try to remove flickering on OsX + correct cScenario::get_ter_from_ground
This commit is contained in:
@@ -605,11 +605,11 @@ static bool handle_rb_action(location the_point, bool option_hit) {
|
||||
current_terrain->area_desc.pop_back();
|
||||
else if(j == size_before)
|
||||
break;
|
||||
else current_terrain->area_desc[j] = {0, 0, 0, 0, "*"};
|
||||
else current_terrain->get_area_desc(j) = {0, 0, 0, 0, "*"};
|
||||
} else {
|
||||
if(j == size_before)
|
||||
current_terrain->area_desc.emplace_back(0,0,0,0,"*");
|
||||
if(!edit_text_str(j,STRS_OUT_RECT) && j == size_before && current_terrain->area_desc[j].descr == "*")
|
||||
if(!edit_text_str(j,STRS_OUT_RECT) && j == size_before && current_terrain->get_area_desc(j).descr == "*")
|
||||
current_terrain->area_desc.pop_back();
|
||||
}
|
||||
start_string_editing(STRS_OUT_RECT,size_before == current_terrain->area_desc.size());
|
||||
@@ -624,11 +624,11 @@ static bool handle_rb_action(location the_point, bool option_hit) {
|
||||
town->area_desc.pop_back();
|
||||
else if(j == size_before)
|
||||
break;
|
||||
else town->area_desc[j] = {0, 0, 0, 0, "*"};
|
||||
else town->get_area_desc(j) = {0, 0, 0, 0, "*"};
|
||||
} else {
|
||||
if(j == size_before)
|
||||
town->area_desc.emplace_back(0,0,0,0,"*");
|
||||
if(!edit_text_str(j,STRS_TOWN_RECT) && j == size_before && town->area_desc[j].descr == "*")
|
||||
if(!edit_text_str(j,STRS_TOWN_RECT) && j == size_before && town->get_area_desc(j).descr == "*")
|
||||
town->area_desc.pop_back();
|
||||
}
|
||||
start_string_editing(STRS_TOWN_RECT,size_before == town->area_desc.size());
|
||||
@@ -926,8 +926,8 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
||||
case MODE_TOGGLE_SPECIAL_DOT:
|
||||
if(!editing_town){
|
||||
if(!mouse_button_held)
|
||||
mode_count = !current_terrain->special_spot[spot_hit.x][spot_hit.y];
|
||||
current_terrain->special_spot[spot_hit.x][spot_hit.y] = mode_count;
|
||||
mode_count = !current_terrain->is_special_spot(spot_hit.x,spot_hit.y);
|
||||
current_terrain->set_special_spot(spot_hit.x,spot_hit.y,mode_count);
|
||||
mouse_button_held = true;
|
||||
break;
|
||||
}
|
||||
@@ -937,8 +937,8 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
|
||||
case MODE_TOGGLE_ROAD:
|
||||
if(!editing_town){
|
||||
if(!mouse_button_held)
|
||||
mode_count = !current_terrain->roads[spot_hit.x][spot_hit.y];
|
||||
current_terrain->roads[spot_hit.x][spot_hit.y] = mode_count;
|
||||
mode_count = !current_terrain->is_road(spot_hit.x,spot_hit.y);
|
||||
current_terrain->set_road(spot_hit.x,spot_hit.y,mode_count);
|
||||
mouse_button_held = true;
|
||||
break;
|
||||
}
|
||||
@@ -2571,11 +2571,11 @@ void start_string_editing(eStrMode mode,short just_redo_text) {
|
||||
set_rb(i,RB_TOWN_SIGN, i,str.str());
|
||||
break;
|
||||
case 6:
|
||||
str << i << " - " << current_terrain->area_desc[i].descr.substr(0,30);
|
||||
str << i << " - " << current_terrain->get_area_desc(i).descr.substr(0,30);
|
||||
set_rb(i,RB_OUT_RECT, i,str.str());
|
||||
break;
|
||||
case 7:
|
||||
str << i << " - " << town->area_desc[i].descr.substr(0,30);
|
||||
str << i << " - " << town->get_area_desc(i).descr.substr(0,30);
|
||||
set_rb(i,RB_TOWN_RECT, i,str.str());
|
||||
break;
|
||||
}
|
||||
|
@@ -888,7 +888,7 @@ map_data buildOutMapData(location which, cScenario& scenario) {
|
||||
terrain.set(x, y, sector.terrain[x][y]);
|
||||
if(sector.special_spot[x][y])
|
||||
terrain.addFeature(x, y, eMapFeature::FIELD, SPECIAL_SPOT);
|
||||
if(sector.roads[x][y])
|
||||
if(sector.is_road(x,y))
|
||||
terrain.addFeature(x, y, eMapFeature::FIELD, SPECIAL_ROAD);
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@ void undo_clip();
|
||||
|
||||
short find_index_spot();
|
||||
bool is_s_d();
|
||||
void sort_specials();
|
||||
|
||||
extern cOutdoors* current_terrain;
|
||||
extern sf::RenderWindow mainPtr;
|
||||
@@ -1428,23 +1427,17 @@ bool is_special(short i,short j) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void sort_specials() {
|
||||
}
|
||||
|
||||
bool is_spot(short i,short j){
|
||||
if(editing_town)
|
||||
return is_field_type(i,j,SPECIAL_SPOT);
|
||||
else if(i >= 0 && i < 48 && j >= 0 && j < 48)
|
||||
return current_terrain->special_spot[i][j];
|
||||
return false;
|
||||
return current_terrain->is_special_spot(i,j);
|
||||
}
|
||||
|
||||
bool is_road(short i,short j){
|
||||
if(editing_town)
|
||||
return is_field_type(i,j,SPECIAL_ROAD);
|
||||
else if(i >= 0 && i < 48 && j >= 0 && j < 48)
|
||||
return current_terrain->roads[i][j];
|
||||
return false;
|
||||
else
|
||||
return current_terrain->is_road(i,j);
|
||||
}
|
||||
|
||||
bool is_field_type(short i,short j,eFieldType field_type) {
|
||||
|
@@ -74,8 +74,8 @@ static std::string& fetch_str(eStrMode str_mode, size_t which) {
|
||||
case 3: return scenario.get_journal_string(which);
|
||||
case 4: return current_terrain->get_sign_loc(which).text;
|
||||
case 5: return town->get_sign_loc(which).text;
|
||||
case 6: return current_terrain->area_desc[which].descr;
|
||||
case 7: return town->area_desc[which].descr;
|
||||
case 6: return current_terrain->get_area_desc(which).descr;
|
||||
case 7: return town->get_area_desc(which).descr;
|
||||
}
|
||||
throw "Invalid string mode " + std::to_string(str_mode) + " (valid are 0-5)";
|
||||
}
|
||||
@@ -96,16 +96,16 @@ static std::string str_info(eStrMode str_mode, size_t which) {
|
||||
sout << ", " << town->get_sign_loc(which).y << ")";
|
||||
break;
|
||||
case 6:
|
||||
sout << "(" << current_terrain->area_desc[which].left;
|
||||
sout << ", " << current_terrain->area_desc[which].top;
|
||||
sout << ")|(" << current_terrain->area_desc[which].right;
|
||||
sout << ", " << current_terrain->area_desc[which].bottom << ")";
|
||||
sout << "(" << current_terrain->get_area_desc(which).left;
|
||||
sout << ", " << current_terrain->get_area_desc(which).top;
|
||||
sout << ")|(" << current_terrain->get_area_desc(which).right;
|
||||
sout << ", " << current_terrain->get_area_desc(which).bottom << ")";
|
||||
break;
|
||||
case 7:
|
||||
sout << "(" << town->area_desc[which].left;
|
||||
sout << ", " << town->area_desc[which].top;
|
||||
sout << ")|(" << town->area_desc[which].right;
|
||||
sout << ", " << town->area_desc[which].bottom << ")";
|
||||
sout << "(" << town->get_area_desc(which).left;
|
||||
sout << ", " << town->get_area_desc(which).top;
|
||||
sout << ")|(" << town->get_area_desc(which).right;
|
||||
sout << ", " << town->get_area_desc(which).bottom << ")";
|
||||
break;
|
||||
}
|
||||
return sout.str();
|
||||
|
Reference in New Issue
Block a user