tDon't use deprecated glib functions - vaccinewars - be a doctor and try to vac… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b6fafc5ac33d990ad0fe3e1a86214d4c908ea9fb | |
parent 095cd8e73f65905c97841c5ddc2fe5fcff7bf3ac | |
Author: Ben Webb <[email protected]> | |
Date: Sat, 24 Oct 2020 23:23:36 -0700 | |
Don't use deprecated glib functions | |
Diffstat: | |
M src/curses_client/curses_client.c | 64 ++++++++++++++++-------------… | |
M src/dopewars.c | 8 ++++---- | |
M src/error.c | 2 +- | |
M src/gui_client/gtk_client.c | 58 +++++++++++++++--------------- | |
M src/log.c | 2 +- | |
M src/message.c | 91 ++++++++++++++++-------------… | |
M src/network.c | 20 ++++++++++---------- | |
M src/serverside.c | 38 ++++++++++++++++-------------… | |
M src/sound.c | 2 +- | |
M src/tstring.c | 14 +++++++------- | |
M src/tstring.h | 4 ++-- | |
11 files changed, 152 insertions(+), 151 deletions(-) | |
--- | |
diff --git a/src/curses_client/curses_client.c b/src/curses_client/curses_clien… | |
t@@ -294,7 +294,7 @@ void display_intro(void) | |
"possible (and stay alive)!")); | |
mvaddcentstr(8, _("You have one month of game time to make your fortune.")); | |
- g_string_sprintf(text, _("Version %-8s Copyright (C) 1998-2015 Ben Webb " | |
+ g_string_printf(text, _("Version %-8s Copyright (C) 1998-2015 Ben Webb " | |
"[email protected]"), VERSION); | |
mvaddcentstr(10, text->str); | |
g_string_assign(text, _("dopewars is released under the GNU " | |
t@@ -434,23 +434,23 @@ static gboolean SelectServerFromMetaServer(Player *Play,… | |
attrset(TextAttr); | |
clear_bottom(); | |
/* Printout of metaserver information in curses client */ | |
- g_string_sprintf(text, _("Server : %s"), ThisServer->Name); | |
+ g_string_printf(text, _("Server : %s"), ThisServer->Name); | |
mvaddstr(top + 1, 1, text->str); | |
- g_string_sprintf(text, _("Port : %d"), ThisServer->Port); | |
+ g_string_printf(text, _("Port : %d"), ThisServer->Port); | |
mvaddstr(top + 2, 1, text->str); | |
- g_string_sprintf(text, _("Version : %s"), ThisServer->Version); | |
+ g_string_printf(text, _("Version : %s"), ThisServer->Version); | |
mvaddstr(top + 2, 40, text->str); | |
if (ThisServer->CurPlayers == -1) { | |
- g_string_sprintf(text, _("Players: -unknown- (maximum %d)"), | |
+ g_string_printf(text, _("Players: -unknown- (maximum %d)"), | |
ThisServer->MaxPlayers); | |
} else { | |
- g_string_sprintf(text, _("Players: %d (maximum %d)"), | |
+ g_string_printf(text, _("Players: %d (maximum %d)"), | |
ThisServer->CurPlayers, ThisServer->MaxPlayers); | |
} | |
mvaddstr(top + 3, 1, text->str); | |
- g_string_sprintf(text, _("Up since : %s"), ThisServer->UpSince); | |
+ g_string_printf(text, _("Up since : %s"), ThisServer->UpSince); | |
mvaddstr(top + 3, 40, text->str); | |
- g_string_sprintf(text, _("Comment: %s"), ThisServer->Comment); | |
+ g_string_printf(text, _("Comment: %s"), ThisServer->Comment); | |
mvaddstr(top + 4, 1, text->str); | |
attrset(PromptAttr); | |
mvaddstr(top + 5, 1, | |
t@@ -513,14 +513,14 @@ static void DisplayConnectStatus(NetworkBuffer *netbuf, | |
case NBS_SOCKSCONNECT: | |
switch (sockstat) { | |
case NBSS_METHODS: | |
- g_string_sprintf(text, _("Connected to SOCKS server %s..."), | |
+ g_string_printf(text, _("Connected to SOCKS server %s..."), | |
Socks.name); | |
break; | |
case NBSS_USERPASSWD: | |
g_string_assign(text, _("Authenticating with SOCKS server")); | |
break; | |
case NBSS_CONNECT: | |
- g_string_sprintf(text, _("Asking SOCKS for connect to %s..."), | |
+ g_string_printf(text, _("Asking SOCKS for connect to %s..."), | |
ServerName); | |
break; | |
} | |
t@@ -813,11 +813,11 @@ static gboolean jet(Player *Play, gboolean AllowReturn) | |
do { | |
c = bgetch(); | |
if (c >= '1' && c < '1' + NumLocation) { | |
- dpg_string_sprintf(str, _("%/Location display/%tde"), | |
+ dpg_string_printf(str, _("%/Location display/%tde"), | |
Location[c - '1'].Name); | |
addstr(str->str); | |
if (Play->IsAt != c - '1') { | |
- g_string_sprintf(str, "%d", c - '1'); | |
+ g_string_printf(str, "%d", c - '1'); | |
DisplayMode = DM_NONE; | |
SendClientMessage(Play, C_NONE, C_REQUESTJET, NULL, str->str); | |
} else { | |
t@@ -846,7 +846,7 @@ static void DropDrugs(Player *Play) | |
attrset(TextAttr); | |
clear_bottom(); | |
text = g_string_new(""); | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
/* List of drugs that you can drop (%tde = "drugs" by | |
* default) */ | |
_("You can\'t get any cash for the following " | |
t@@ -855,7 +855,7 @@ static void DropDrugs(Player *Play) | |
NumDrugs = 0; | |
for (i = 0; i < NumDrug; i++) { | |
if (Play->Drugs[i].Carried > 0 && Play->Drugs[i].Price == 0) { | |
- g_string_sprintf(text, "%c. %-10s %-8d", NumDrugs + 'A', | |
+ g_string_printf(text, "%c. %-10s %-8d", NumDrugs + 'A', | |
Drug[i].Name, Play->Drugs[i].Carried); | |
mvaddstr(top + NumDrugs / 3, (NumDrugs % 3) * 25 + 4, text->str); | |
NumDrugs++; | |
t@@ -877,7 +877,7 @@ static void DropDrugs(Player *Play) | |
num = atoi(buf); | |
g_free(buf); | |
if (num > 0) { | |
- g_string_sprintf(text, "drug^%d^%d", i, -num); | |
+ g_string_printf(text, "drug^%d^%d", i, -num); | |
SendClientMessage(Play, C_NONE, C_BUYOBJECT, NULL, text->str); | |
} | |
} | |
t@@ -979,17 +979,17 @@ static void GiveErrand(Player *Play) | |
/* Prompt for sending your bitches out to spy etc. (%tde = "bitches" by | |
* default) */ | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("Choose an errand to give one of your %tde..."), | |
Names.Bitches); | |
mvaddstr(y++, 1, text->str); | |
attrset(PromptAttr); | |
if (Play->Bitches.Carried > 0) { | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_(" S>py on another dealer " | |
"(cost: %P)"), Prices.Spy); | |
mvaddstr(y++, 2, text->str); | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_(" T>ip off the cops to another dealer " | |
"(cost: %P)"), Prices.Tipoff); | |
mvaddstr(y++, 2, text->str); | |
t@@ -1976,40 +1976,40 @@ void print_status(Player *Play, gboolean DispDrug) | |
/* Display of the player's cash in the stats window (careful to keep the | |
* formatting if you change the length of the "Cash" word) */ | |
- dpg_string_sprintf(text, _("Cash %17P"), Play->Cash); | |
+ dpg_string_printf(text, _("Cash %17P"), Play->Cash); | |
mvaddstr(3, 9, text->str); | |
/* Display of the total number of guns carried (%Tde="Guns" by default) */ | |
- dpg_string_sprintf(text, _("%-19Tde%3d"), Names.Guns, | |
+ dpg_string_printf(text, _("%-19Tde%3d"), Names.Guns, | |
TotalGunsCarried(Play)); | |
mvaddstr(Network ? 4 : 5, 9, text->str); | |
/* Display of the player's health */ | |
- g_string_sprintf(text, _("Health %3d"), Play->Health); | |
+ g_string_printf(text, _("Health %3d"), Play->Health); | |
mvaddstr(Network ? 5 : 7, 9, text->str); | |
/* Display of the player's bank balance */ | |
- dpg_string_sprintf(text, _("Bank %17P"), Play->Bank); | |
+ dpg_string_printf(text, _("Bank %17P"), Play->Bank); | |
mvaddstr(Network ? 6 : 9, 9, text->str); | |
if (Play->Debt > 0) | |
attrset(DebtAttr); | |
/* Display of the player's debt */ | |
- dpg_string_sprintf(text, _("Debt %17P"), Play->Debt); | |
+ dpg_string_printf(text, _("Debt %17P"), Play->Debt); | |
mvaddstr(Network ? 7 : 11, 9, text->str); | |
attrset(TitleAttr); | |
/* Display of the player's trenchcoat size (antique mode only) */ | |
if (WantAntique) | |
- g_string_sprintf(text, _("Space %6d"), Play->CoatSize); | |
+ g_string_printf(text, _("Space %6d"), Play->CoatSize); | |
else { | |
/* Display of the player's number of bitches, and available space | |
* (%Tde="Bitches" by default) */ | |
- dpg_string_sprintf(text, _("%Tde %3d Space %6d"), Names.Bitches, | |
+ dpg_string_printf(text, _("%Tde %3d Space %6d"), Names.Bitches, | |
Play->Bitches.Carried, Play->CoatSize); | |
} | |
mvaddstr(0, Width - 2 - strlen(text->str), text->str); | |
- dpg_string_sprintf(text, _("%/Current location/%tde"), | |
+ dpg_string_printf(text, _("%/Current location/%tde"), | |
Location[Play->IsAt].Name); | |
print_location(text->str); | |
attrset(StatsAttr); | |
t@@ -2024,7 +2024,7 @@ void print_status(Player *Play, gboolean DispDrug) | |
* string is the "%Tde" which is "Drugs" by default; the %/.../ part | |
* is ignored, so you don't need to translate it; see doc/i18n.html) | |
*/ | |
- dpg_string_sprintf(text, _("%/Stats: Drugs/%Tde"), Names.Drugs); | |
+ dpg_string_printf(text, _("%/Stats: Drugs/%Tde"), Names.Drugs); | |
mvaddstr(1, Width * 3 / 4 - strlen(text->str) / 2, text->str); | |
} | |
for (i = 0; i < NumDrug; i++) { | |
t@@ -2032,14 +2032,14 @@ void print_status(Player *Play, gboolean DispDrug) | |
/* Display of carried drugs with price (%tde="Opium", etc. by | |
* default) */ | |
if (HaveAbility(Play, A_DRUGVALUE)) { | |
- dpg_string_sprintf(text, _("%-7tde %3d @ %P"), Drug[i].Name, | |
+ dpg_string_printf(text, _("%-7tde %3d @ %P"), Drug[i].Name, | |
Play->Drugs[i].Carried, | |
Play->Drugs[i].TotalValue / | |
Play->Drugs[i].Carried); | |
mvaddstr(3 + c, Width / 2 + 3, text->str); | |
} else { | |
/* Display of carried drugs (%tde="Opium", etc. by default) */ | |
- dpg_string_sprintf(text, _("%-7tde %3d"), Drug[i].Name, | |
+ dpg_string_printf(text, _("%-7tde %3d"), Drug[i].Name, | |
Play->Drugs[i].Carried); | |
mvaddstr(3 + c / 2, Width / 2 + 3 + (c % 2) * 17, text->str); | |
} | |
t@@ -2049,12 +2049,12 @@ void print_status(Player *Play, gboolean DispDrug) | |
} else { | |
/* Title of the "guns" window (the only important bit in this string | |
* is the "%Tde" which is "Guns" by default) */ | |
- dpg_string_sprintf(text, _("%/Stats: Guns/%Tde"), Names.Guns); | |
+ dpg_string_printf(text, _("%/Stats: Guns/%Tde"), Names.Guns); | |
mvaddstr(1, Width * 3 / 4 - strlen(text->str) / 2, text->str); | |
for (i = 0; i < NumGun; i++) { | |
if (Play->Guns[i].Carried > 0) { | |
/* Display of carried guns (%tde="Baretta", etc. by default) */ | |
- dpg_string_sprintf(text, _("%-22tde %3d"), Gun[i].Name, | |
+ dpg_string_printf(text, _("%-22tde %3d"), Gun[i].Name, | |
Play->Guns[i].Carried); | |
mvaddstr(3 + c, Width / 2 + 3, text->str); | |
c++; | |
t@@ -2428,7 +2428,7 @@ static void Curses_DoGame(Player *Play) | |
g_string_append(text, _("R>un, ")); | |
if (!RunHere || fp == F_LASTLEAVE) | |
/* (%tde = "drugs" by default here) */ | |
- dpg_string_sprintfa(text, _("D>eal %tde, "), Names.Drugs); | |
+ dpg_string_append_printf(text, _("D>eal %tde, "), Names.Drugs); | |
g_string_append(text, _("or Q>uit? ")); | |
mvaddcentstr(get_prompt_line(), text->str); | |
attrset(TextAttr); | |
diff --git a/src/dopewars.c b/src/dopewars.c | |
t@@ -1462,7 +1462,7 @@ void AddListEntry(DopeList *List, DopeEntry *NewEntry) | |
List->Number++; | |
List->Data = (DopeEntry *)g_realloc(List->Data, List->Number * | |
sizeof(DopeEntry)); | |
- g_memmove(&(List->Data[List->Number - 1]), NewEntry, sizeof(DopeEntry)); | |
+ memmove(&(List->Data[List->Number - 1]), NewEntry, sizeof(DopeEntry)); | |
} | |
/* | |
t@@ -1474,7 +1474,7 @@ void RemoveListEntry(DopeList *List, int Index) | |
return; | |
if (Index < List->Number - 1) { | |
- g_memmove(&(List->Data[Index]), &(List->Data[Index + 1]), | |
+ memmove(&(List->Data[Index]), &(List->Data[Index + 1]), | |
(List->Number - 1 - Index) * sizeof(DopeEntry)); | |
} | |
List->Number--; | |
t@@ -2146,12 +2146,12 @@ void PrintConfigValue(int GlobalIndex, int StructIndex, | |
/* Display of the first part of an entire string list config. file | |
* variable - e.g. "StoppedTo is { " (followed by "have a beer", | |
* "smoke a joint" etc.) */ | |
- g_string_sprintf(text, _("%s is { "), GlobalName); | |
+ g_string_printf(text, _("%s is { "), GlobalName); | |
if (Globals[GlobalIndex].MaxIndex) { | |
for (i = 0; i < *(Globals[GlobalIndex].MaxIndex); i++) { | |
if (i > 0) | |
g_string_append(text, ", "); | |
- g_string_sprintfa(text, "\"%s\"", | |
+ g_string_append_printf(text, "\"%s\"", | |
(*(Globals[GlobalIndex].StringList))[i]); | |
} | |
} | |
diff --git a/src/error.c b/src/error.c | |
t@@ -114,7 +114,7 @@ void LookupErrorCode(GString *str, gint code, ErrTable *ta… | |
return; | |
} | |
} | |
- g_string_sprintfa(str, fallbackstr, code); | |
+ g_string_append_printf(str, fallbackstr, code); | |
} | |
/* "Custom" error handling */ | |
diff --git a/src/gui_client/gtk_client.c b/src/gui_client/gtk_client.c | |
t@@ -1212,14 +1212,14 @@ void DisplayStats(Player *Play, struct StatusWidgets *… | |
text = g_string_new(NULL); | |
- dpg_string_sprintf(text, _("%/Current location/%tde"), | |
+ dpg_string_printf(text, _("%/Current location/%tde"), | |
Location[Play->IsAt].Name); | |
gtk_label_set_text(GTK_LABEL(Status->Location), text->str); | |
GetDateString(text, Play); | |
gtk_label_set_text(GTK_LABEL(Status->Date), text->str); | |
- g_string_sprintf(text, "%d", Play->CoatSize); | |
+ g_string_printf(text, "%d", Play->CoatSize); | |
gtk_label_set_text(GTK_LABEL(Status->SpaceValue), text->str); | |
prstr = FormatPrice(Play->Cash); | |
t@@ -1236,25 +1236,25 @@ void DisplayStats(Player *Play, struct StatusWidgets *… | |
/* Display of carried guns in GTK+ client status window (%Tde="Guns" by | |
* default) */ | |
- dpg_string_sprintf(text, _("%/GTK Stats: Guns/%Tde"), Names.Guns); | |
+ dpg_string_printf(text, _("%/GTK Stats: Guns/%Tde"), Names.Guns); | |
gtk_label_set_text(GTK_LABEL(Status->GunsName), text->str); | |
- g_string_sprintf(text, "%d", TotalGunsCarried(Play)); | |
+ g_string_printf(text, "%d", TotalGunsCarried(Play)); | |
gtk_label_set_text(GTK_LABEL(Status->GunsValue), text->str); | |
if (!WantAntique) { | |
/* Display of number of bitches in GTK+ client status window | |
* (%Tde="Bitches" by default) */ | |
- dpg_string_sprintf(text, _("%/GTK Stats: Bitches/%Tde"), | |
+ dpg_string_printf(text, _("%/GTK Stats: Bitches/%Tde"), | |
Names.Bitches); | |
gtk_label_set_text(GTK_LABEL(Status->BitchesName), text->str); | |
- g_string_sprintf(text, "%d", Play->Bitches.Carried); | |
+ g_string_printf(text, "%d", Play->Bitches.Carried); | |
gtk_label_set_text(GTK_LABEL(Status->BitchesValue), text->str); | |
} else { | |
gtk_label_set_text(GTK_LABEL(Status->BitchesName), NULL); | |
gtk_label_set_text(GTK_LABEL(Status->BitchesValue), NULL); | |
} | |
- g_string_sprintf(text, "%d", Play->Health); | |
+ g_string_printf(text, "%d", Play->Health); | |
gtk_label_set_text(GTK_LABEL(Status->HealthValue), text->str); | |
g_string_free(text, TRUE); | |
t@@ -1526,21 +1526,21 @@ static void UpdateDealDialog(void) | |
/* Display of the current price of the selected drug in 'Deal Drugs' | |
* dialog */ | |
- dpg_string_sprintf(text, _("at %P"), Play->Drugs[DrugInd].Price); | |
+ dpg_string_printf(text, _("at %P"), Play->Drugs[DrugInd].Price); | |
gtk_label_set_text(GTK_LABEL(DealDialog.cost), text->str); | |
CanDrop = Play->Drugs[DrugInd].Carried; | |
/* Display of current inventory of the selected drug in 'Deal Drugs' | |
* dialog (%tde="Opium" etc. by default) */ | |
- dpg_string_sprintf(text, _("You are currently carrying %d %tde"), | |
+ dpg_string_printf(text, _("You are currently carrying %d %tde"), | |
CanDrop, Drug[DrugInd].Name); | |
gtk_label_set_text(GTK_LABEL(DealDialog.carrying), text->str); | |
CanCarry = Play->CoatSize; | |
/* Available space for drugs in 'Deal Drugs' dialog */ | |
- g_string_sprintf(text, _("Available space: %d"), CanCarry); | |
+ g_string_printf(text, _("Available space: %d"), CanCarry); | |
gtk_label_set_text(GTK_LABEL(DealDialog.space), text->str); | |
if (DealDialog.Type == BT_BUY) { | |
t@@ -1553,7 +1553,7 @@ static void UpdateDealDialog(void) | |
/* Number of the selected drug that you can afford in 'Deal Drugs' | |
* dialog */ | |
- g_string_sprintf(text, _("You can afford %d"), CanAfford); | |
+ g_string_printf(text, _("You can afford %d"), CanAfford); | |
gtk_label_set_text(GTK_LABEL(DealDialog.afford), text->str); | |
MaxDrug = MIN(CanCarry, CanAfford); | |
} else { | |
t@@ -1693,7 +1693,7 @@ void DealDrugs(GtkWidget *widget, gpointer data) | |
|| (data == BT_SELL && Play->Drugs[i].Carried > 0 | |
&& Play->Drugs[i].Price != 0) | |
|| (data == BT_BUY && Play->Drugs[i].Price != 0)) { | |
- dpg_string_sprintf(text, _("%/DealDrugs drug name/%tde"), Drug[i].Name); | |
+ dpg_string_printf(text, _("%/DealDrugs drug name/%tde"), Drug[i].Name); | |
menuitem = gtk_menu_item_new_with_label(text->str); | |
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", | |
GTK_SIGNAL_FUNC(DealSelectCallback), | |
t@@ -1727,11 +1727,11 @@ void DealDrugs(GtkWidget *widget, gpointer data) | |
hbox = gtk_hbox_new(FALSE, 7); | |
if (data == BT_BUY) { | |
/* Prompts for action in the "deal drugs" dialog */ | |
- g_string_sprintf(text, _("Buy how many?")); | |
+ g_string_printf(text, _("Buy how many?")); | |
} else if (data == BT_SELL) { | |
- g_string_sprintf(text, _("Sell how many?")); | |
+ g_string_printf(text, _("Sell how many?")); | |
} else { | |
- g_string_sprintf(text, _("Drop how many?")); | |
+ g_string_printf(text, _("Drop how many?")); | |
} | |
label = gtk_label_new(text->str); | |
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
t@@ -1814,23 +1814,23 @@ void DealGuns(GtkWidget *widget, gpointer data) | |
text = g_string_new(""); | |
if (data != BT_BUY && TotalGunsCarried(ClientData.Play) == 0) { | |
- dpg_string_sprintf(text, _("You don't have any %tde to sell!"), | |
+ dpg_string_printf(text, _("You don't have any %tde to sell!"), | |
Names.Guns); | |
GtkMessageBox(dialog, text->str, Title, GTK_MESSAGE_WARNING, MB_OK); | |
} else if (data == BT_BUY && TotalGunsCarried(ClientData.Play) >= | |
ClientData.Play->Bitches.Carried + 2) { | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("You'll need more %tde to carry any more %tde!"), | |
Names.Bitches, Names.Guns); | |
GtkMessageBox(dialog, text->str, Title, GTK_MESSAGE_WARNING, MB_OK); | |
} else if (data == BT_BUY | |
&& Gun[GunInd].Space > ClientData.Play->CoatSize) { | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("You don't have enough space to carry that %tde!"), | |
Names.Gun); | |
GtkMessageBox(dialog, text->str, Title, GTK_MESSAGE_WARNING, MB_OK); | |
} else if (data == BT_BUY && Gun[GunInd].Price > ClientData.Play->Cash) { | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("You don't have enough cash to buy that %tde!"), | |
Names.Gun); | |
GtkMessageBox(dialog, text->str, Title, GTK_MESSAGE_WARNING, MB_OK); | |
t@@ -1838,7 +1838,7 @@ void DealGuns(GtkWidget *widget, gpointer data) | |
GtkMessageBox(dialog, _("You don't have any to sell!"), Title, | |
GTK_MESSAGE_WARNING, MB_OK); | |
} else { | |
- g_string_sprintf(text, "gun^%d^%d", GunInd, data == BT_BUY ? 1 : -1); | |
+ g_string_printf(text, "gun^%d^%d", GunInd, data == BT_BUY ? 1 : -1); | |
SendClientMessage(ClientData.Play, C_NONE, C_BUYOBJECT, NULL, | |
text->str); | |
} | |
t@@ -2561,11 +2561,11 @@ void TransferDialog(gboolean Debt) | |
GTK_SIGNAL_FUNC(SendDoneMessage), NULL); | |
if (Debt) { | |
/* Title of loan shark dialog - (%Tde="The Loan Shark" by default) */ | |
- dpg_string_sprintf(text, _("%/LoanShark window title/%Tde"), | |
+ dpg_string_printf(text, _("%/LoanShark window title/%Tde"), | |
Names.LoanSharkName); | |
} else { | |
/* Title of bank dialog - (%Tde="The Bank" by default) */ | |
- dpg_string_sprintf(text, _("%/BankName window title/%Tde"), | |
+ dpg_string_printf(text, _("%/BankName window title/%Tde"), | |
Names.BankName); | |
} | |
gtk_window_set_title(GTK_WINDOW(dialog), text->str); | |
t@@ -2581,16 +2581,16 @@ void TransferDialog(gboolean Debt) | |
gtk_table_set_col_spacings(GTK_TABLE(table), 4); | |
/* Display of player's cash in bank or loan shark dialog */ | |
- dpg_string_sprintf(text, _("Cash: %P"), ClientData.Play->Cash); | |
+ dpg_string_printf(text, _("Cash: %P"), ClientData.Play->Cash); | |
label = gtk_label_new(text->str); | |
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 3, 0, 1); | |
if (Debt) { | |
/* Display of player's debt in loan shark dialog */ | |
- dpg_string_sprintf(text, _("Debt: %P"), ClientData.Play->Debt); | |
+ dpg_string_printf(text, _("Debt: %P"), ClientData.Play->Debt); | |
} else { | |
/* Display of player's bank balance in bank dialog */ | |
- dpg_string_sprintf(text, _("Bank: %P"), ClientData.Play->Bank); | |
+ dpg_string_printf(text, _("Bank: %P"), ClientData.Play->Bank); | |
} | |
label = gtk_label_new(text->str); | |
gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 3, 1, 2); | |
t@@ -2727,7 +2727,7 @@ static void TalkSend(GtkWidget *widget, struct TalkStruc… | |
if (AllPlayers) { | |
SendClientMessage(ClientData.Play, C_NONE, C_MSG, NULL, text); | |
- g_string_sprintf(msg, "%s: %s", GetPlayerName(ClientData.Play), text); | |
+ g_string_printf(msg, "%s: %s", GetPlayerName(ClientData.Play), text); | |
PrintMessage(msg->str, "talk"); | |
} else { | |
for (selection = GTK_CLIST(TalkData->clist)->selection; selection; | |
t@@ -2736,7 +2736,7 @@ static void TalkSend(GtkWidget *widget, struct TalkStruc… | |
Play = (Player *)gtk_clist_get_row_data(GTK_CLIST(TalkData->clist), row); | |
if (Play) { | |
SendClientMessage(ClientData.Play, C_NONE, C_MSGTO, Play, text); | |
- g_string_sprintf(msg, "%s->%s: %s", GetPlayerName(ClientData.Play), | |
+ g_string_printf(msg, "%s->%s: %s", GetPlayerName(ClientData.Play), | |
GetPlayerName(Play), text); | |
PrintMessage(msg->str, "page"); | |
} | |
t@@ -3036,13 +3036,13 @@ void CreateInventory(GtkWidget *hbox, gchar *Objects, | |
if (CreateHere) { | |
/* Title of the display of available drugs/guns (%Tde = "Guns" or | |
* "Drugs" by default) */ | |
- dpg_string_sprintf(text, _("%Tde here"), Objects); | |
+ dpg_string_printf(text, _("%Tde here"), Objects); | |
widgets->HereFrame = frame[0] = gtk_frame_new(text->str); | |
} | |
/* Title of the display of carried drugs/guns (%Tde = "Guns" or "Drugs" | |
* by default) */ | |
- dpg_string_sprintf(text, _("%Tde carried"), Objects); | |
+ dpg_string_printf(text, _("%Tde carried"), Objects); | |
widgets->CarriedFrame = frame[1] = gtk_frame_new(text->str); | |
diff --git a/src/log.c b/src/log.c | |
t@@ -96,7 +96,7 @@ GString *GetLogString(GLogLevelFlags log_level, const gchar … | |
g_string_free(text, TRUE); | |
return NULL; | |
} | |
- g_string_sprintfa(text, "%d: ", i); | |
+ g_string_append_printf(text, "%d: ", i); | |
} | |
g_string_append(text, message); | |
return text; | |
diff --git a/src/message.c b/src/message.c | |
t@@ -145,10 +145,10 @@ void DoSendClientMessage(Player *From, AICode AI, MsgCod… | |
text = g_string_new(NULL); | |
if (HaveAbility(BufOwn, A_PLAYERID)) { | |
if (To) | |
- g_string_sprintfa(text, "%d", To->ID); | |
- g_string_sprintfa(text, "^%c%c%s", AI, Code, Data ? Data : ""); | |
+ g_string_append_printf(text, "%d", To->ID); | |
+ g_string_append_printf(text, "^%c%c%s", AI, Code, Data ? Data : ""); | |
} else { | |
- g_string_sprintf(text, "%s^%s^%c%c%s", From ? GetPlayerName(From) : "", | |
+ g_string_printf(text, "%s^%s^%c%c%s", From ? GetPlayerName(From) : "", | |
To ? GetPlayerName(To) : "", AI, Code, | |
Data ? Data : ""); | |
} | |
t@@ -206,10 +206,10 @@ void SendServerMessage(Player *From, AICode AI, MsgCode … | |
text = g_string_new(NULL); | |
if (HaveAbility(To, A_PLAYERID)) { | |
if (From) | |
- g_string_sprintfa(text, "%d", From->ID); | |
- g_string_sprintfa(text, "^%c%c%s", AI, Code, Data ? Data : ""); | |
+ g_string_append_printf(text, "%d", From->ID); | |
+ g_string_append_printf(text, "^%c%c%s", AI, Code, Data ? Data : ""); | |
} else { | |
- g_string_sprintf(text, "%s^%s^%c%c%s", From ? GetPlayerName(From) : "", | |
+ g_string_printf(text, "%s^%s^%c%c%s", From ? GetPlayerName(From) : "", | |
To ? GetPlayerName(To) : "", AI, Code, | |
Data ? Data : ""); | |
} | |
t@@ -413,15 +413,15 @@ static void MetaAppendError(GString *str, LastError *err… | |
{ | |
switch (error->code) { | |
case MEC_INTERNAL: | |
- g_string_sprintfa(str, _("Internal metaserver error \"%s\""), | |
+ g_string_append_printf(str, _("Internal metaserver error \"%s\""), | |
(gchar *)error->data); | |
break; | |
case MEC_BADREPLY: | |
- g_string_sprintfa(str, _("Bad metaserver reply \"%s\""), | |
+ g_string_append_printf(str, _("Bad metaserver reply \"%s\""), | |
(gchar *)error->data); | |
break; | |
default: | |
- g_string_sprintfa(str, _("Unknown metaserver error code %d"), | |
+ g_string_append_printf(str, _("Unknown metaserver error code %d"), | |
error->code); | |
break; | |
} | |
t@@ -554,7 +554,7 @@ void AddURLEnc(GString *str, gchar *unenc) | |
} else if (unenc[i] == ' ') { | |
g_string_append_c(str, '+'); | |
} else { | |
- g_string_sprintfa(str, "%%%02X", unenc[i]); | |
+ g_string_append_printf(str, "%%%02X", unenc[i]); | |
} | |
} | |
} | |
t@@ -590,10 +590,10 @@ void SendInventory(Player *From, AICode AI, MsgCode Code, | |
text = g_string_new(NULL); | |
for (i = 0; i < NumGun; i++) { | |
- g_string_sprintfa(text, "%d:", Guns ? Guns[i].Carried : 0); | |
+ g_string_append_printf(text, "%d:", Guns ? Guns[i].Carried : 0); | |
} | |
for (i = 0; i < NumDrug; i++) { | |
- g_string_sprintfa(text, "%d:", Drugs ? Drugs[i].Carried : 0); | |
+ g_string_append_printf(text, "%d:", Drugs ? Drugs[i].Carried : 0); | |
} | |
SendServerMessage(From, AI, Code, To, text->str); | |
g_string_free(text, TRUE); | |
t@@ -641,7 +641,7 @@ void SendSpyReport(Player *To, Player *SpiedOn) | |
int i; | |
text = g_string_new(NULL); | |
- g_string_sprintf(text, "%s^%s^%s^%d^%d^%d^%d^%d^", | |
+ g_string_printf(text, "%s^%s^%s^%d^%d^%d^%d^%d^", | |
(cashstr = pricetostr(SpiedOn->Cash)), | |
(debtstr = pricetostr(SpiedOn->Debt)), | |
(bankstr = pricetostr(SpiedOn->Bank)), | |
t@@ -651,23 +651,24 @@ void SendSpyReport(Player *To, Player *SpiedOn) | |
g_free(debtstr); | |
g_free(bankstr); | |
if (HaveAbility(SpiedOn, A_DATE)) { | |
- g_string_sprintfa(text, "%d^%d^%d^", g_date_day(SpiedOn->date), | |
- g_date_month(SpiedOn->date), g_date_year(SpiedOn->date)); | |
+ g_string_append_printf(text, "%d^%d^%d^", g_date_get_day(SpiedOn->date), | |
+ g_date_get_month(SpiedOn->date), | |
+ g_date_get_year(SpiedOn->date)); | |
} | |
for (i = 0; i < NumGun; i++) { | |
- g_string_sprintfa(text, "%d^", SpiedOn->Guns[i].Carried); | |
+ g_string_append_printf(text, "%d^", SpiedOn->Guns[i].Carried); | |
} | |
for (i = 0; i < NumDrug; i++) { | |
- g_string_sprintfa(text, "%d^", SpiedOn->Drugs[i].Carried); | |
+ g_string_append_printf(text, "%d^", SpiedOn->Drugs[i].Carried); | |
} | |
if (HaveAbility(To, A_DRUGVALUE)) | |
for (i = 0; i < NumDrug; i++) { | |
- g_string_sprintfa(text, "%s^", | |
+ g_string_append_printf(text, "%s^", | |
(cashstr = | |
pricetostr(SpiedOn->Drugs[i].TotalValue))); | |
g_free(cashstr); | |
} | |
- g_string_sprintfa(text, "%d", SpiedOn->Bitches.Carried); | |
+ g_string_append_printf(text, "%d", SpiedOn->Bitches.Carried); | |
if (To != SpiedOn) | |
SendServerMessage(SpiedOn, C_NONE, C_UPDATE, To, text->str); | |
else | |
t@@ -695,7 +696,7 @@ void SendInitialData(Player *To) | |
LocalNames[i] = GetDefaultTString(LocalNames[i]); | |
} | |
text = g_string_new(""); | |
- g_string_sprintf(text, "%s^%d^%d^%d^", VERSION, NumLocation, NumGun, | |
+ g_string_printf(text, "%s^%d^%d^%d^", VERSION, NumLocation, NumGun, | |
NumDrug); | |
for (i = 0; i < 6; i++) { | |
g_string_append(text, LocalNames[i]); | |
t@@ -706,11 +707,11 @@ void SendInitialData(Player *To) | |
g_string_append(text, LocalNames[6]); | |
g_string_append_c(text, '^'); | |
} else { | |
- g_string_sprintfa(text, "%d-^-%d^", StartDate.month, StartDate.year); | |
+ g_string_append_printf(text, "%d-^-%d^", StartDate.month, StartDate.year); | |
} | |
if (HaveAbility(To, A_PLAYERID)) | |
- g_string_sprintfa(text, "%d^", To->ID); | |
+ g_string_append_printf(text, "%d^", To->ID); | |
/* Player ID is expected after the first 7 names, so send the rest now */ | |
for (i = 7; i < NUMNAMES; i++) { | |
t@@ -723,7 +724,7 @@ void SendInitialData(Player *To) | |
g_free(LocalNames[i]); | |
} | |
- g_string_sprintfa(text, "%c%s^", Currency.Prefix ? '1' : '0', | |
+ g_string_append_printf(text, "%c%s^", Currency.Prefix ? '1' : '0', | |
Currency.Symbol); | |
SendServerMessage(NULL, C_NONE, C_INIT, To, text->str); | |
g_string_free(text, TRUE); | |
t@@ -1301,7 +1302,7 @@ void SendFightMessage(Player *Attacker, Player *Defender, | |
} | |
} else | |
BitchName = ""; | |
- g_string_sprintf(text, "%s^%s^%d^%d^%s^%d^%d^%c%c%c%c^", | |
+ g_string_printf(text, "%s^%s^%d^%d^%s^%d^%d^%c%c%c%c^", | |
Attacker == To ? "" : GetPlayerName(Attacker), | |
(Defender == To || Defender == NULL) | |
? "" : GetPlayerName(Defender), | |
t@@ -1369,29 +1370,29 @@ void FormatFightMessage(Player *To, GString *text, Pla… | |
if (DefendName[0]) { | |
if (IsCop(Defender) && !AttackName[0]) { | |
if (Bitches == 0) { | |
- dpg_string_sprintfa(text, _("%s - %s - is chasing you, man!"), | |
+ dpg_string_append_printf(text, _("%s - %s - is chasing you, man!"), | |
DefendName, Armament); | |
} else { | |
- dpg_string_sprintfa(text, | |
+ dpg_string_append_printf(text, | |
_("%s and %d %tde - %s - are chasing you, man!"), | |
DefendName, Bitches, BitchesName, Armament); | |
} | |
} else { | |
- dpg_string_sprintfa(text, _("%s arrives with %d %tde, %s!"), | |
+ dpg_string_append_printf(text, _("%s arrives with %d %tde, %s!"), | |
DefendName, Bitches, BitchesName, Armament); | |
} | |
} | |
break; | |
case F_STAND: | |
if (AttackName[0]) { | |
- g_string_sprintfa(text, _("%s stands and takes it"), AttackName); | |
+ g_string_append_printf(text, _("%s stands and takes it"), AttackName); | |
} else { | |
g_string_append(text, _("You stand there like a dummy.")); | |
} | |
break; | |
case F_FAILFLEE: | |
if (AttackName[0]) { | |
- g_string_sprintfa(text, _("%s tries to get away, but fails."), | |
+ g_string_append_printf(text, _("%s tries to get away, but fails."), | |
AttackName); | |
} else { | |
g_string_append(text, _("Panic! You can't get away!")); | |
t@@ -1403,13 +1404,13 @@ void FormatFightMessage(Player *To, GString *text, Pla… | |
if (AttackName[0]) { | |
if (!IsCop(Attacker) && brandom(0, 100) < 70 | |
&& Attacker->IsAt >= 0) { | |
- dpg_string_sprintfa(text, _("%s has got away to %tde!"), AttackName, | |
+ dpg_string_append_printf(text, _("%s has got away to %tde!"), Attack… | |
Location[Attacker->IsAt].Name); | |
} else { | |
- g_string_sprintfa(text, _("%s has got away!"), AttackName); | |
+ g_string_append_printf(text, _("%s has got away!"), AttackName); | |
} | |
} else { | |
- g_string_sprintfa(text, _("You got away!")); | |
+ g_string_append_printf(text, _("You got away!")); | |
} | |
} | |
break; | |
t@@ -1420,49 +1421,49 @@ void FormatFightMessage(Player *To, GString *text, Pla… | |
break; | |
case F_MISS: | |
if (AttackName[0] && DefendName[0]) { | |
- g_string_sprintfa(text, _("%s shoots at %s... and misses!"), | |
+ g_string_append_printf(text, _("%s shoots at %s... and misses!"), | |
AttackName, DefendName); | |
} else if (AttackName[0]) { | |
- g_string_sprintfa(text, _("%s shoots at you... and misses!"), | |
+ g_string_append_printf(text, _("%s shoots at you... and misses!"), | |
AttackName); | |
} else if (DefendName[0]) { | |
- g_string_sprintfa(text, _("You missed %s!"), DefendName); | |
+ g_string_append_printf(text, _("You missed %s!"), DefendName); | |
} | |
break; | |
case F_HIT: | |
if (AttackName[0] && DefendName[0]) { | |
if (Health == 0 && Bitches == 0) { | |
- g_string_sprintfa(text, _("%s shoots %s dead."), | |
+ g_string_append_printf(text, _("%s shoots %s dead."), | |
AttackName, DefendName); | |
} else if (BitchesKilled) { | |
- dpg_string_sprintfa(text, _("%s shoots at %s and kills a %tde!"), | |
+ dpg_string_append_printf(text, _("%s shoots at %s and kills a %tde!"), | |
AttackName, DefendName, BitchName); | |
} else { | |
- g_string_sprintfa(text, _("%s shoots at %s."), | |
+ g_string_append_printf(text, _("%s shoots at %s."), | |
AttackName, DefendName); | |
} | |
} else if (AttackName[0]) { | |
if (Health == 0 && Bitches == 0) { | |
- g_string_sprintfa(text, _("%s wasted you, man! What a drag!"), | |
+ g_string_append_printf(text, _("%s wasted you, man! What a drag!"), | |
AttackName); | |
} else if (BitchesKilled) { | |
- dpg_string_sprintfa(text, | |
+ dpg_string_append_printf(text, | |
_("%s shoots at you... and kills a %tde!"), | |
AttackName, BitchName); | |
} else { | |
- g_string_sprintfa(text, _("%s hits you, man!"), AttackName); | |
+ g_string_append_printf(text, _("%s hits you, man!"), AttackName); | |
} | |
} else if (DefendName[0]) { | |
if (Health == 0 && Bitches == 0) { | |
- g_string_sprintfa(text, _("You killed %s!"), DefendName); | |
+ g_string_append_printf(text, _("You killed %s!"), DefendName); | |
} else if (BitchesKilled) { | |
- dpg_string_sprintfa(text, _("You hit %s, and killed a %tde!"), | |
+ dpg_string_append_printf(text, _("You hit %s, and killed a %tde!"), | |
DefendName, BitchName); | |
} else { | |
- g_string_sprintfa(text, _("You hit %s!"), DefendName); | |
+ g_string_append_printf(text, _("You hit %s!"), DefendName); | |
} | |
if (Loot > 0) { | |
- dpg_string_sprintfa(text, _(" You find %P on the body!"), Loot); | |
+ dpg_string_append_printf(text, _(" You find %P on the body!"), Loot); | |
} else if (Loot < 0) { | |
g_string_append(text, _(" You loot the body!")); | |
} | |
diff --git a/src/network.c b/src/network.c | |
t@@ -420,13 +420,13 @@ static void HTTPAppendError(GString *str, LastError *err… | |
g_string_append(str, _("Number of tries exceeded")); | |
break; | |
case HEC_BADAUTH: | |
- g_string_sprintfa(str, _("Bad auth header: %s"), (gchar *)error->data); | |
+ g_string_append_printf(str, _("Bad auth header: %s"), (gchar *)error->data… | |
break; | |
case HEC_BADREDIR: | |
- g_string_sprintfa(str, _("Bad redirect: %s"), (gchar *)error->data); | |
+ g_string_append_printf(str, _("Bad redirect: %s"), (gchar *)error->data); | |
break; | |
case HEC_BADSTATUS: | |
- g_string_sprintfa(str, _("Invalid HTTP status line: %s"), | |
+ g_string_append_printf(str, _("Invalid HTTP status line: %s"), | |
(gchar *)error->data); | |
break; | |
case HEC_FORBIDDEN: | |
t@@ -447,13 +447,13 @@ static void HTTPAppendError(GString *str, LastError *err… | |
break; | |
default: | |
if (error->code < HEC_REDIRECT || error->code >= 600) { | |
- g_string_sprintfa(str, _("Unknown HTTP error %d"), error->code); | |
+ g_string_append_printf(str, _("Unknown HTTP error %d"), error->code); | |
} else if (error->code < HEC_CLIENTERR) { | |
- g_string_sprintfa(str, _("%d: redirect error"), error->code); | |
+ g_string_append_printf(str, _("%d: redirect error"), error->code); | |
} else if (error->code < HEC_SERVERERR) { | |
- g_string_sprintfa(str, _("%d: HTTP client error"), error->code); | |
+ g_string_append_printf(str, _("%d: HTTP client error"), error->code); | |
} else { | |
- g_string_sprintfa(str, _("%d: HTTP server error"), error->code); | |
+ g_string_append_printf(str, _("%d: HTTP server error"), error->code); | |
} | |
break; | |
} | |
t@@ -1142,11 +1142,11 @@ static void SendHttpRequest(HttpConnection *conn) | |
text = g_string_new(""); | |
- g_string_sprintf(text, "%s %s HTTP/1.0", | |
+ g_string_printf(text, "%s %s HTTP/1.0", | |
conn->Method, conn->Query); | |
QueueMessageForSend(&conn->NetBuf, text->str); | |
- g_string_sprintf(text, "Host: %s", conn->HostName); | |
+ g_string_printf(text, "Host: %s", conn->HostName); | |
QueueMessageForSend(&conn->NetBuf, text->str); | |
if (conn->Headers) | |
t@@ -1168,7 +1168,7 @@ static void SendHttpRequest(HttpConnection *conn) | |
QueueMessageForSend(&conn->NetBuf, text->str); | |
} | |
- g_string_sprintf(text, "User-Agent: dopewars/%s", VERSION); | |
+ g_string_printf(text, "User-Agent: dopewars/%s", VERSION); | |
QueueMessageForSend(&conn->NetBuf, text->str); | |
/* Insert a blank line between headers and body */ | |
diff --git a/src/serverside.c b/src/serverside.c | |
t@@ -254,9 +254,9 @@ void RegisterWithMetaServer(gboolean Up, gboolean SendData, | |
g_string_assign(body, "output=text&"); | |
- g_string_sprintfa(body, "up=%d&port=%d&version=", Up ? 1 : 0, Port); | |
+ g_string_append_printf(body, "up=%d&port=%d&version=", Up ? 1 : 0, Port); | |
AddURLEnc(body, VERSION); | |
- g_string_sprintfa(body, "&players=%d&maxplay=%d&comment=", | |
+ g_string_append_printf(body, "&players=%d&maxplay=%d&comment=", | |
CountPlayers(FirstServer), MaxClients); | |
AddURLEnc(body, MetaServer.Comment); | |
t@@ -272,11 +272,11 @@ void RegisterWithMetaServer(gboolean Up, gboolean SendDa… | |
if (SendData && HighScoreRead(ScoreFP, MultiScore, AntiqueScore, TRUE)) { | |
for (i = 0; i < NUMHISCORE; i++) { | |
if (MultiScore[i].Name && MultiScore[i].Name[0]) { | |
- g_string_sprintfa(body, "&nm[%d]=", i); | |
+ g_string_append_printf(body, "&nm[%d]=", i); | |
AddURLEnc(body, MultiScore[i].Name); | |
- g_string_sprintfa(body, "&dt[%d]=", i); | |
+ g_string_append_printf(body, "&dt[%d]=", i); | |
AddURLEnc(body, MultiScore[i].Time); | |
- g_string_sprintfa(body, "&st[%d]=%s&sc[%d]=", i, | |
+ g_string_append_printf(body, "&st[%d]=%s&sc[%d]=", i, | |
MultiScore[i].Dead ? "dead" : "alive", i); | |
AddURLEnc(body, prstr = FormatPrice(MultiScore[i].Money)); | |
g_free(prstr); | |
t@@ -284,7 +284,7 @@ void RegisterWithMetaServer(gboolean Up, gboolean SendData, | |
} | |
} | |
- g_string_sprintf(headers, | |
+ g_string_printf(headers, | |
"Content-Type: application/x-www-form-urlencoded\n" | |
"Content-Length: %d", (int)strlen(body->str)); | |
t@@ -351,7 +351,7 @@ void SendPlayerDetails(Player *Play, Player *To, MsgCode C… | |
text = g_string_new(GetPlayerName(Play)); | |
if (HaveAbility(To, A_PLAYERID)) { | |
- g_string_sprintfa(text, "^%d", Play->ID); | |
+ g_string_append_printf(text, "^%d", Play->ID); | |
} | |
SendServerMessage(NULL, C_NONE, Code, To, text->str); | |
g_string_free(text, TRUE); | |
t@@ -735,7 +735,7 @@ void PrintHelpTo(FILE *fp) | |
fprintf(fp, _(HelpText), VERSION); | |
for (i = 0; i < NUMGLOB; i++) { | |
if (Globals[i].NameStruct[0]) { | |
- g_string_sprintf(VarName, "%s%s.%s", Globals[i].NameStruct, | |
+ g_string_printf(VarName, "%s%s.%s", Globals[i].NameStruct, | |
Globals[i].StructListPt ? "[x]" : "", | |
Globals[i].Name); | |
} else { | |
t@@ -759,7 +759,7 @@ void ServerHelp(void) | |
g_print(_(HelpText), VERSION); | |
for (i = 0; i < NUMGLOB; i++) { | |
if (Globals[i].NameStruct[0]) { | |
- g_string_sprintf(VarName, "%s%s.%s", Globals[i].NameStruct, | |
+ g_string_printf(VarName, "%s%s.%s", Globals[i].NameStruct, | |
Globals[i].StructListPt ? "[x]" : "", | |
Globals[i].Name); | |
} else { | |
t@@ -2985,11 +2985,11 @@ void ResolveTipoff(Player *Play) | |
RemoveListPlayer(&(Play->TipList), Play->OnBehalfOf); | |
text = g_string_new(""); | |
if (Play->Health == 0) { | |
- g_string_sprintf(text, | |
+ g_string_printf(text, | |
_("Following your tipoff, the cops ambushed %s, " | |
"who was shot dead!"), GetPlayerName(Play)); | |
} else { | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("Following your tipoff, the cops ambushed %s, " | |
"who escaped with %d %tde. "), GetPlayerName(Play), | |
Play->Bitches.Carried, Names.Bitches); | |
t@@ -3096,13 +3096,13 @@ int RandomOffer(Player *To) | |
} | |
if (ind == -1) { | |
ind = brandom(0, NumDrug); | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("You meet a friend! He gives you %d %tde."), | |
amount, Drug[ind].Name); | |
To->Drugs[ind].Carried += amount; | |
To->CoatSize -= amount; | |
} else { | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("You meet a friend! You give him %d %tde."), | |
amount, Drug[ind].Name); | |
To->Drugs[ind].TotalValue = | |
t@@ -3121,7 +3121,7 @@ int RandomOffer(Player *To) | |
amount = brandom(3, 7); | |
ind = IsCarryingRandom(To, amount); | |
if (ind != -1) { | |
- dpg_string_sprintf(text, _("Police dogs chase you for %d blocks! " | |
+ dpg_string_printf(text, _("Police dogs chase you for %d blocks! " | |
"You dropped some %tde! That's a drag, man!"), | |
brandom(3, 7), Names.Drugs); | |
To->Drugs[ind].TotalValue = To->Drugs[ind].TotalValue * | |
t@@ -3137,7 +3137,7 @@ int RandomOffer(Player *To) | |
g_string_free(text, TRUE); | |
return 0; | |
} | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("You find %d %tde on a dead dude in the subway!"), | |
amount, Drug[ind].Name); | |
To->Drugs[ind].Carried += amount; | |
t@@ -3152,7 +3152,7 @@ int RandomOffer(Player *To) | |
amount = brandom(2, 6); | |
if (amount > To->Drugs[ind].Carried) | |
amount = To->Drugs[ind].Carried; | |
- dpg_string_sprintf(text, | |
+ dpg_string_printf(text, | |
_("Your mama made brownies with some of your %tde! " | |
"They were great!"), Drug[ind].Name); | |
To->Drugs[ind].TotalValue = To->Drugs[ind].TotalValue * | |
t@@ -3170,7 +3170,7 @@ int RandomOffer(Player *To) | |
g_string_free(text, TRUE); | |
return 1; | |
} else if (NumStoppedTo > 0) { | |
- g_string_sprintf(text, _("You stopped to %s."), | |
+ g_string_printf(text, _("You stopped to %s."), | |
StoppedTo[brandom(0, NumStoppedTo)]); | |
amount = brandom(1, 10); | |
if (To->Cash >= amount) | |
t@@ -3309,7 +3309,7 @@ void SendDrugsHere(Player *To, gboolean DisplayBusts) | |
if (Deal[i] == DT_CHEAP) { | |
g_string_append(text, Drug[i].CheapStr); | |
} else { | |
- dpg_string_sprintfa(text, brandom(0, 100) < 50 | |
+ dpg_string_append_printf(text, brandom(0, 100) < 50 | |
? Drugs.ExpensiveStr1 : Drugs.ExpensiveStr2, | |
Drug[i].Name); | |
} | |
t@@ -3323,7 +3323,7 @@ void SendDrugsHere(Player *To, gboolean DisplayBusts) | |
SendPrintMessage(NULL, C_NONE, To, text->str); | |
g_string_truncate(text, 0); | |
for (i = 0; i < NumDrug; i++) { | |
- g_string_sprintfa(text, "%s^", | |
+ g_string_append_printf(text, "%s^", | |
(prstr = pricetostr(To->Drugs[i].Price))); | |
g_free(prstr); | |
} | |
diff --git a/src/sound.c b/src/sound.c | |
t@@ -60,7 +60,7 @@ gchar *GetPluginList(void) | |
SoundDriver *drivpt = (SoundDriver *)listpt->data; | |
if (drivpt && drivpt->name) { | |
- g_string_sprintfa(plugins, ", \"%s\"", drivpt->name); | |
+ g_string_append_printf(plugins, ", \"%s\"", drivpt->name); | |
} | |
} | |
retstr = plugins->str; | |
diff --git a/src/tstring.c b/src/tstring.c | |
t@@ -238,24 +238,24 @@ gchar *HandleTFmt(gchar *format, va_list va) | |
g_error("Unmatched types!"); | |
switch (Type) { | |
case 'd': | |
- g_string_sprintfa(string, tmpfmt->str, fdat->data.IntVal); | |
+ g_string_append_printf(string, tmpfmt->str, fdat->data.IntVal); | |
break; | |
case 'c': | |
- g_string_sprintfa(string, tmpfmt->str, fdat->data.CharVal); | |
+ g_string_append_printf(string, tmpfmt->str, fdat->data.CharVal); | |
break; | |
case 'P': | |
fstr = FormatPrice(fdat->data.PriceVal); | |
- g_string_sprintfa(string, tmpfmt->str, fstr); | |
+ g_string_append_printf(string, tmpfmt->str, fstr); | |
g_free(fstr); | |
break; | |
case 't': | |
case 'T': | |
fstr = GetTranslatedString(fdat->data.StrVal, Code, Type == 'T'); | |
- g_string_sprintfa(string, tmpfmt->str, fstr); | |
+ g_string_append_printf(string, tmpfmt->str, fstr); | |
g_free(fstr); | |
break; | |
case 's': | |
- g_string_sprintfa(string, tmpfmt->str, fdat->data.StrVal); | |
+ g_string_append_printf(string, tmpfmt->str, fdat->data.StrVal); | |
break; | |
case '%': | |
g_string_append_c(string, '%'); | |
t@@ -292,7 +292,7 @@ gchar *dpg_strdup_printf(gchar *format, ...) | |
return retstr; | |
} | |
-void dpg_string_sprintf(GString *string, gchar *format, ...) | |
+void dpg_string_printf(GString *string, gchar *format, ...) | |
{ | |
va_list ap; | |
gchar *newstr; | |
t@@ -304,7 +304,7 @@ void dpg_string_sprintf(GString *string, gchar *format, ..… | |
va_end(ap); | |
} | |
-void dpg_string_sprintfa(GString *string, gchar *format, ...) | |
+void dpg_string_append_printf(GString *string, gchar *format, ...) | |
{ | |
va_list ap; | |
gchar *newstr; | |
diff --git a/src/tstring.h b/src/tstring.h | |
t@@ -31,8 +31,8 @@ | |
void dpg_print(gchar *format, ...); | |
gchar *dpg_strdup_printf(gchar *format, ...); | |
-void dpg_string_sprintf(GString *string, gchar *format, ...); | |
-void dpg_string_sprintfa(GString *string, gchar *format, ...); | |
+void dpg_string_printf(GString *string, gchar *format, ...); | |
+void dpg_string_append_printf(GString *string, gchar *format, ...); | |
gchar *GetDefaultTString(gchar *tstring); | |