[mw-devel] MW3 r1124 - branches/nomud/src
welshbyte at sucs.org
welshbyte at sucs.org
Thu Dec 10 14:46:00 GMT 2009
Author: welshbyte
Date: 2009-12-10 14:46:00 +0000 (Thu, 10 Dec 2009)
New Revision: 1124
Modified:
branches/nomud/src/rooms.c
Log:
- Remove the now-unused string_lines function
- Use the existing str2num function in LoadRoom instead of duplicating code
Modified: branches/nomud/src/rooms.c
===================================================================
--- branches/nomud/src/rooms.c 2009-12-10 13:11:58 UTC (rev 1123)
+++ branches/nomud/src/rooms.c 2009-12-10 14:46:00 UTC (rev 1124)
@@ -45,15 +45,6 @@
SAFE_FREE(room->prompt);
}
-void string_lines(char *text)
-{
- char *a;
-
- if (text == NULL) return;
-
- while ((a=strchr(text, '$'))!=NULL) *a='\n';
-}
-
int str2num(char *in)
{
int out;
@@ -72,8 +63,6 @@
int LoadRoom(struct room *room, int num)
{
- char *tmp;
-
if (room==NULL) return(0);
if (num < 0 || num > 65535) return(0);
@@ -81,23 +70,10 @@
room->name = db_room_get(num, "name");
room->desc = db_room_get(num, "desc");
room->prompt = db_room_get(num, "prompt");
+ room->hidden = str2num(db_room_get(num, "hidden"));
+ room->sproof = str2num(db_room_get(num, "soundproof"));
+ room->locked = str2num(db_room_get(num, "locked"));
- tmp = db_room_get(num, "hidden");
- if (tmp) {
- room->hidden = atoi(tmp);
- free(tmp);
- }
- tmp = db_room_get(num, "soundproof");
- if (tmp) {
- room->sproof = atoi(tmp);
- free(tmp);
- }
- tmp = db_room_get(num, "locked");
- if (tmp) {
- room->locked = atoi(tmp);
- free(tmp);
- }
-
return 1;
}
More information about the mw-devel
mailing list