Store rect descriptions together with their rectangle and remove now-unused string-length members

This commit is contained in:
2015-01-22 15:19:26 -05:00
parent 3e0e3d3b8a
commit 952d81ae5a
18 changed files with 58 additions and 112 deletions

View File

@@ -292,11 +292,11 @@ static bool save_roomdescs(cDialog& me, bool isTown, bool str_do_delete[]) {
for(int i = 0; i < numDescs; i++) {
std::string id = "desc" + std::to_string(i + 1);
if(isTown) {
town->rect_names[i] = me[id].getText().substr(0,30);
town->room_rect[i].descr = me[id].getText().substr(0,30);
if(str_do_delete[i])
town->room_rect(i).right = 0;
town->room_rect[i].right = 0;
} else {
current_terrain->rect_names[i] = me[id].getText().substr(0,30);
current_terrain->info_rect[i].descr = me[id].getText().substr(0,30);
if(str_do_delete[i])
current_terrain->info_rect[i].right = 0;
}
@@ -310,17 +310,17 @@ static void put_roomdescs_in_dlog(cDialog& me, bool isTown, bool str_do_delete[]
std::string id = std::to_string(i + 1);
std::ostringstream str;
bool active = true;
if(isTown && town->room_rect(i).right == 0) active = false;
if(isTown && town->room_rect[i].right == 0) active = false;
if(!isTown && current_terrain->info_rect[i].right == 0) active = false;
if(str_do_delete[i]) active = false;
if(!active) {
str << "Not yet placed.";
me["del" + id].hide();
} else if(isTown) {
me["desc" + id].setText(town->rect_names[i]);
str << "X = " << town->room_rect(i).left << ", Y = " << town->room_rect(i).top;
me["desc" + id].setText(town->room_rect[i].descr);
str << "X = " << town->room_rect[i].left << ", Y = " << town->room_rect[i].top;
} else {
me["desc" + id].setText(current_terrain->rect_names[i]);
me["desc" + id].setText(current_terrain->info_rect[i].descr);
str << "X = " << current_terrain->info_rect[i].left << ", Y = " << current_terrain->info_rect[i].top;
}
me["rect" + id].setText(str.str());