Remove c_str() calls made redundant by the previous commit

This commit is contained in:
2014-04-15 21:18:36 -04:00
parent f91ca72631
commit 6060ba6750
8 changed files with 22 additions and 23 deletions

View File

@@ -365,7 +365,7 @@ void draw_startup_stats()
TEXT.pointSize = 14;
pc_rect.offset(35,0);
win_draw_string(mainPtr,pc_rect,(char*)univ.party[i].name.c_str(),0,18,ul);
win_draw_string(mainPtr,pc_rect,univ.party[i].name,0,18,ul);
to_rect.offset(pc_rect.left + 8,pc_rect.top + 8);
}
@@ -396,11 +396,11 @@ void draw_startup_stats()
case RACE_BIRD: sprintf((char *) str,"Level %d Bird",univ.party[i].level); break;
default: sprintf((char *) str,"Level %d *ERROR INVALID RACE*",univ.party[i].level); break;
}
win_draw_string(mainPtr,pc_rect,(char *) str,0,18,ul);
win_draw_string(mainPtr,pc_rect,str,0,18,ul);
pc_rect.offset(0,13);
sprintf((char *) str,"Health %d, Spell pts. %d",
univ.party[i].max_health,univ.party[i].max_sp);
win_draw_string(mainPtr,pc_rect,(char *) str,0,18,ul);
win_draw_string(mainPtr,pc_rect,str,0,18,ul);
break;
case MAIN_STATUS_DEAD:
win_draw_string(mainPtr,pc_rect,"Dead",0,18,ul);
@@ -465,7 +465,7 @@ void draw_start_button(short which_position,short which_button)
TEXT.colour = base_color;
if (which_position == 3)
to_rect.offset(-7,0);
win_draw_string(mainPtr,to_rect,(char *) button_labels[which_position],1,18,ul);
win_draw_string(mainPtr,to_rect,button_labels[which_position],1,18,ul);
TEXT.colour = sf::Color::Black;
TEXT.font = "Geneva";
TEXT.style = sf::Text::Bold;
@@ -1537,7 +1537,7 @@ void boom_space(location where,short mode,short type,short damage,short sound)
if ((damage < 10) && (dest_rect.right - dest_rect.left > 19))
text_rect.left += 10;
text_rect.offset(-4,-5);
win_draw_string(mainPtr,text_rect,(char *) dam_str,1,10,ul);
win_draw_string(mainPtr,text_rect,dam_str,1,10,ul);
TEXT.style = sf::Text::Regular;
}
play_sound((skip_boom_delay?-1:1)*sound_to_play[sound]);

View File

@@ -1152,10 +1152,10 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
TEXT.colour = c[3];
dest_rect = title_rect;
dest_rect.offset(1,1);
win_draw_string(talk_gworld,dest_rect,title_string.c_str(),2,18);
win_draw_string(talk_gworld,dest_rect,title_string,2,18);
dest_rect.offset(-1,-1);
TEXT.colour = c[4];
win_draw_string(talk_gworld,dest_rect,title_string.c_str(),2,18);
win_draw_string(talk_gworld,dest_rect,title_string,2,18);
// Place buttons at bottom.
if (color == 0)
@@ -1195,7 +1195,7 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
TEXT.colour = c[2];
else TEXT.colour = c[1];
// TODO: The clickable text doesn't work, and the entire text flashes when clicking anything
win_draw_string(talk_gworld, dest_rect, str.c_str(), 0, line_height);
win_draw_string(talk_gworld, dest_rect, str, 0, line_height);
for (i = 0;i < str_len;i++) {
if (((str[i] != 39) && ((str[i] < 65) || (str[i] > 122)) && ((str[i] < 48) || (str[i] > 57))) && (color == 0)) { // New word, so set up a rect
if (((i - store_last_word_break >= 4) || (i >= str_len - 1))
@@ -1273,7 +1273,7 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
}
last_line_break = store_last_word_break = last_word_break = last_stored_word_break = 0;
win_draw_string(talk_gworld, dest_rect, str.c_str(), 0, line_height);
win_draw_string(talk_gworld, dest_rect, str, 0, line_height);
for (i = 0;i < str_len;i++) {
if (((str[i] != 39) && ((str[i] < 65) || (str[i] > 122)) && ((str[i] < 48) || (str[i] > 57))) && (color == 0)) { // New word, so set up a rect
if (((i - store_last_word_break >= 4) || (i >= str_len - 1))

View File

@@ -306,7 +306,7 @@ void put_item_screen(short screen_num,short suppress_buttons)
TEXT.style = sf::Text::Regular;
sout.str("");;
sout << univ.party[pc].name << " inventory:",
win_draw_string(item_stats_gworld,upper_frame_rect,sout.str().c_str(),0,10);
win_draw_string(item_stats_gworld,upper_frame_rect,sout.str(),0,10);
TEXT.colour = sf::Color::Black;
TEXT.font = "Silom";
@@ -314,7 +314,7 @@ void put_item_screen(short screen_num,short suppress_buttons)
i_num = i + item_offset;
sout.str("");
sout << i_num + 1 << '.';
win_draw_string(item_stats_gworld,item_buttons[i][0],sout.str().c_str(),0,10);
win_draw_string(item_stats_gworld,item_buttons[i][0],sout.str(),0,10);
dest_rect = item_buttons[i][0];
dest_rect.left += 36;
@@ -344,7 +344,7 @@ void put_item_screen(short screen_num,short suppress_buttons)
sout << '(' << int(univ.party[pc].items[i_num].charges) << ')';
}
dest_rect.left -= 2;
win_draw_string(item_stats_gworld,dest_rect,sout.str().c_str(),0,10);
win_draw_string(item_stats_gworld,dest_rect,sout.str(),0,10);
TEXT.style = sf::Text::Regular;
TEXT.colour = sf::Color::Black;
@@ -669,7 +669,7 @@ void draw_pc_effects(short pc)
dest_rect.bottom += pc * 25 + 18;
}
else {
name_width = string_length(univ.party[pc].name.c_str());
name_width = string_length(univ.party[pc].name);
right_limit = pc_buttons[0][1].left - 5;
//dest_rect.left = pc_buttons[i][1].left - 16;
dest_rect.left = name_width + 33;

View File

@@ -42,7 +42,6 @@ void through_sending();
RECT coord_to_rect(short i,short j);
void make_cursor_sword() ;
std::string get_str(std::string list, short j);
short string_length(char *str);
short calc_day();
bool day_reached(unsigned char which_day, unsigned char which_event);
void Draw_Some_Item (sf::Texture& src_gworld, RECT src_rect, sf::RenderTarget& targ_gworld, location target, char masked, short main_win);

View File

@@ -74,7 +74,7 @@ void cButton::draw(){
} else if(type == BTN_PUSH) {
to_rect.top += 34;
}
win_draw_string(*inWindow,to_rect,lbl.c_str(),textMode,8);
win_draw_string(*inWindow,to_rect,lbl,textMode,8);
// TODO: Adjust string location as appropriate
// Tiny button string location should be shifted right 20 pixels (or possibly 18)
// Push button string should be centred below the button
@@ -258,7 +258,7 @@ void cLed::draw(){
TEXT.colour = parent->defTextClr;
to_rect.right = frame.right;
to_rect.left = frame.left + 18; // Possibly could be 20
win_draw_string(*inWindow,to_rect,lbl.c_str(),2,8);
win_draw_string(*inWindow,to_rect,lbl,2,8);
TEXT.colour = sf::Color::Black;
}else{
tileImage(*inWindow,frame,bg_gworld,bg[parent->bg]);

View File

@@ -268,7 +268,7 @@ void cThreeChoice::init_strings(std::vector<std::string>& strings, unsigned shor
RECT cur_text_rect = {2, left, 0, 0};
size_t total_len, str_width, str_height;
for (unsigned int i = 0; i < strings.size(); i++)
total_len += string_length(strings[i].c_str());
total_len += string_length(strings[i]);
total_len = total_len * 12;
str_width = s_sqrt(total_len) + 20;
//print_nums(0,total_len,str_width);
@@ -279,7 +279,7 @@ void cThreeChoice::init_strings(std::vector<std::string>& strings, unsigned shor
for(unsigned int j = 0; j < strings.size(); j++){
std::ostringstream sout;
sout << "str" << j + 1;
str_height = ((string_length(strings[j].c_str()) + 60) / str_width) * 12 + 16;
str_height = ((string_length(strings[j]) + 60) / str_width) * 12 + 16;
cur_text_rect.bottom = cur_text_rect.top + str_height;
cTextMsg* str = new cTextMsg(me);
str->setText(strings[j]);

View File

@@ -97,10 +97,10 @@ void cTextField::draw(){
if(haveFocus) {
std::string pre_ip = contents.substr(0, insertionPoint);
// TODO: Update string_length to take a std::string
ip_offset = string_length(pre_ip.c_str());
ip_offset = string_length(pre_ip);
if(insertionPoint != selectionPoint) {
std::string pre_sel = contents.substr(0, selectionPoint);
sel_offset = string_length(pre_sel.c_str());
sel_offset = string_length(pre_sel);
int sel_start = std::min(ip_offset, sel_offset) + 1;
int sel_width = abs(ip_offset - sel_offset) + 3;
RECT selectRect = frame;
@@ -122,7 +122,7 @@ void cTextField::draw(){
}
}
// TODO: Update win_draw_string to take a std::string
win_draw_string(*inWindow, rect, contents.c_str(), 0, 14);
win_draw_string(*inWindow, rect, contents, 0, 14);
}
void cTextField::handleInput(cKey key) {

View File

@@ -102,10 +102,10 @@ void cTextMsg::draw(){
TEXT.colour = draw_color;
if (to_rect.bottom - to_rect.top < 20) { // essentially, it's a single line
to_rect.left += 3;
win_draw_string(*inWindow,to_rect,lbl.c_str(),3,12);
win_draw_string(*inWindow,to_rect,lbl,3,12);
}else {
to_rect.inset(4,4);
win_draw_string(*inWindow,to_rect,lbl.c_str(),0,textSize + 2);
win_draw_string(*inWindow,to_rect,lbl,0,textSize + 2);
}
}
}