home · contact · privacy
Server: Rename thing, thing type and thing action selection commands.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 24 Jul 2014 02:33:06 +0000 (04:33 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 24 Jul 2014 02:33:06 +0000 (04:33 +0200)
confserver/world
src/server/god_commands.c
src/server/hardcoded_strings.c
src/server/hardcoded_strings.h
src/server/io.c

index a399aeeffd578181dc882c8c82e46f166997e2e9..0c26815e93d4f4cb8ac11acc307a2e2fbf4f7184 100644 (file)
@@ -1,86 +1,86 @@
 MAP_LENGTH 64
 PLAYER_TYPE 0
 
-THING_ACTION 1
+TA_ID 1
 TA_EFFORT 1
 TA_NAME wait
 
-THING_ACTION 2
+TA_ID 2
 TA_EFFORT 5
 TA_NAME move
 
-THING_ACTION 3
+TA_ID 3
 TA_EFFORT 15
 TA_NAME pick_up
 
-THING_ACTION 4
+TA_ID 4
 TA_EFFORT 5
 TA_NAME drop
 
-THING_ACTION 5
+TA_ID 5
 TA_EFFORT 45
 TA_NAME use
 
-THING_TYPE 0
+TT_ID 0
 TT_START_NUMBER 1
 TT_LIFEPOINTS 5
 TT_SYMBOL @
 TT_NAME HUMAN
 TT_CONSUMABLE 0
 
-THING_TYPE 1
+TT_ID 1
 TT_START_NUMBER 27
 TT_LIFEPOINTS 1
 TT_SYMBOL a
 TT_NAME ANT
 TT_CONSUMABLE 0
 
-THING_TYPE 2
+TT_ID 2
 TT_START_NUMBER 9
 TT_LIFEPOINTS 3
 TT_SYMBOL z
 TT_NAME ZOMBIE
 TT_CONSUMABLE 0
 
-THING_TYPE 3
+TT_ID 3
 TT_START_NUMBER 3
 TT_LIFEPOINTS 9
 TT_SYMBOL S
 TT_NAME SHOGGOTH
 TT_CONSUMABLE 0
 
-THING_TYPE 4
+TT_ID 4
 TT_START_NUMBER 9
 TT_LIFEPOINTS 0
 TT_SYMBOL #
 TT_NAME DIRT
 TT_CONSUMABLE 0
 
-THING_TYPE 5
+TT_ID 5
 TT_START_NUMBER 9
 TT_LIFEPOINTS 0
 TT_SYMBOL %
 TT_NAME SKELETON
 TT_CONSUMABLE 0
 
-THING_TYPE 6
+TT_ID 6
 TT_START_NUMBER 1
 TT_LIFEPOINTS 0
 TT_SYMBOL m
 TT_NAME 'MAGIC MEAT'
 TT_CONSUMABLE 3
 
-THING_TYPE 0
+TT_ID 0
 TT_CORPSE_ID 5
-THING_TYPE 1
+TT_ID 1
 TT_CORPSE_ID 4
-THING_TYPE 2
+TT_ID 2
 TT_CORPSE_ID 5
-THING_TYPE 3
+TT_ID 3
 TT_CORPSE_ID 6
-THING_TYPE 4
+TT_ID 4
 TT_CORPSE_ID 4
-THING_TYPE 5
+TT_ID 5
 TT_CORPSE_ID 4
-THING_TYPE 6
+TT_ID 6
 TT_CORPSE_ID 4
index 02c091aa548edb9e912967964eff7cb03f324227..2962d4cc3195cdeea1d962a6434cf7fd9ec710d0 100644 (file)
@@ -96,7 +96,7 @@ static uint8_t parse_thingtype_manipulation(char * tok0, char * tok1)
         }
         tt->corpse_id = id;
     }
-    else if (parse_val(tok0, tok1, s[S_CMD_THINGTYPE], '8', (char *) &id))
+    else if (parse_val(tok0, tok1, s[S_CMD_TT_ID], '8', (char *) &id))
     {
         tt = get_thing_type(id);
         if (!tt)
@@ -157,7 +157,7 @@ static uint8_t parse_thingaction_manipulation(char * tok0, char * tok1)
             }
         }
     }
-    else if (parse_val(tok0, tok1, s[S_CMD_THINGACTION], 'i', (char *) &id))
+    else if (parse_val(tok0, tok1, s[S_CMD_TA_ID], '8', (char *) &id))
     {
         ta = get_thing_action(id);
         if (!ta)
@@ -293,7 +293,7 @@ static uint8_t parse_thing_manipulation(char * tok0, char * tok1)
         || parse_val(tok0,tok1, s[S_CMD_T_HP], '8', (char *) &t->lifepoints)
         || parse_position(tok0, tok1, t)
         || parse_carry(tok0, tok1, t));
-    else if (parse_val(tok0, tok1, s[S_CMD_THING], 'i', (char *) &id))
+    else if (parse_val(tok0, tok1, s[S_CMD_T_ID], 'i', (char *) &id))
     {
         t = get_thing(world.things, id, 1);
         char * err = "No thing type found to initialize new thing.";
index 6ad856b1563a87444df76982862c064ea235d721..e9578c7572549854a451bd4b3b3a1e34a33ed366 100644 (file)
@@ -16,12 +16,18 @@ extern void init_strings()
     s[S_PATH_IN] = "server/in";
     s[S_PATH_RECORD] = "record";
     s[S_PATH_SAVE] = "savefile";
-    s[S_CMD_MAKE_WORLD] = "MAKE_WORLD";
-    s[S_CMD_WORLD_ACTIVE] = "WORLD_ACTIVE";
-    s[S_CMD_SEED_MAP] = "SEED_MAP";
-    s[S_CMD_SEED_RAND] = "SEED_RANDOMNESS";
-    s[S_CMD_TURN] = "TURN";
-    s[S_CMD_THING] = "THING";
+    s[S_FCN_SPRINTF] = "sprintf";
+    s[S_CMD_TA_ID] = "TA_ID";
+    s[S_CMD_TA_EFFORT] = "TA_EFFORT";
+    s[S_CMD_TA_NAME] = "TA_NAME";
+    s[S_CMD_TT_ID] = "TT_ID";
+    s[S_CMD_TT_CONSUM] = "TT_CONSUMABLE";
+    s[S_CMD_TT_STARTN] = "TT_START_NUMBER";
+    s[S_CMD_TT_HP] = "TT_LIFEPOINTS";
+    s[S_CMD_TT_SYMB] = "TT_SYMBOL";
+    s[S_CMD_TT_NAME] = "TT_NAME";
+    s[S_CMD_TT_CORPS] = "TT_CORPSE_ID";
+    s[S_CMD_T_ID] = "T_ID";
     s[S_CMD_T_TYPE] = "T_TYPE";
     s[S_CMD_T_POSY] = "T_POSY";
     s[S_CMD_T_POSX] = "T_POSX";
@@ -35,17 +41,11 @@ extern void init_strings()
     s[S_CMD_PICKUP] = "pick_up";
     s[S_CMD_DROP] = "drop";
     s[S_CMD_USE] = "use";
-    s[S_FCN_SPRINTF] = "sprintf";
-    s[S_CMD_THINGTYPE] = "THING_TYPE";
-    s[S_CMD_TT_CONSUM] = "TT_CONSUMABLE";
-    s[S_CMD_TT_STARTN] = "TT_START_NUMBER";
-    s[S_CMD_TT_HP] = "TT_LIFEPOINTS";
-    s[S_CMD_TT_SYMB] = "TT_SYMBOL";
-    s[S_CMD_TT_NAME] = "TT_NAME";
-    s[S_CMD_TT_CORPS] = "TT_CORPSE_ID";
-    s[S_CMD_THINGACTION] = "THING_ACTION";
-    s[S_CMD_TA_EFFORT] = "TA_EFFORT";
-    s[S_CMD_TA_NAME] = "TA_NAME";
+    s[S_CMD_MAKE_WORLD] = "MAKE_WORLD";
+    s[S_CMD_WORLD_ACTIVE] = "WORLD_ACTIVE";
+    s[S_CMD_SEED_MAP] = "SEED_MAP";
+    s[S_CMD_SEED_RAND] = "SEED_RANDOMNESS";
+    s[S_CMD_TURN] = "TURN";
     s[S_CMD_MAPLENGTH] = "MAP_LENGTH";
     s[S_CMD_PLAYTYPE] = "PLAYER_TYPE";
 }
index fd9ceb80853f1922a61cbaa08e16d3c1c8aca9b6..27832904de51852b22985e95a6b8576016873804 100644 (file)
@@ -16,12 +16,18 @@ enum string_num
     S_PATH_IN,
     S_PATH_RECORD,
     S_PATH_SAVE,
-    S_CMD_MAKE_WORLD,
-    S_CMD_WORLD_ACTIVE,
-    S_CMD_SEED_MAP,
-    S_CMD_SEED_RAND,
-    S_CMD_TURN,
-    S_CMD_THING,
+    S_FCN_SPRINTF,
+    S_CMD_TA_ID,
+    S_CMD_TA_EFFORT,
+    S_CMD_TA_NAME,
+    S_CMD_TT_ID,
+    S_CMD_TT_CONSUM,
+    S_CMD_TT_STARTN,
+    S_CMD_TT_HP,
+    S_CMD_TT_SYMB,
+    S_CMD_TT_NAME,
+    S_CMD_TT_CORPS,
+    S_CMD_T_ID,
     S_CMD_T_TYPE,
     S_CMD_T_POSY,
     S_CMD_T_POSX,
@@ -35,17 +41,11 @@ enum string_num
     S_CMD_PICKUP,
     S_CMD_DROP,
     S_CMD_USE,
-    S_FCN_SPRINTF,
-    S_CMD_THINGTYPE,
-    S_CMD_TT_CONSUM,
-    S_CMD_TT_STARTN,
-    S_CMD_TT_HP,
-    S_CMD_TT_SYMB,
-    S_CMD_TT_NAME,
-    S_CMD_TT_CORPS,
-    S_CMD_THINGACTION,
-    S_CMD_TA_EFFORT,
-    S_CMD_TA_NAME,
+    S_CMD_MAKE_WORLD,
+    S_CMD_WORLD_ACTIVE,
+    S_CMD_SEED_MAP,
+    S_CMD_SEED_RAND,
+    S_CMD_TURN,
     S_CMD_MAPLENGTH,
     S_CMD_PLAYTYPE
 };
index 17110d324c804e047bcd3a212fccd4165982ee35..f6d6928a2f9e4b9ff1dfeb89f58049c31877427c 100644 (file)
@@ -107,7 +107,7 @@ static void write_thing(FILE * file, struct Thing * t)
     {
         write_thing(file, o);
     }
-    write_key_value(file, s[S_CMD_THING], t->id);
+    write_key_value(file, s[S_CMD_T_ID], t->id);
     write_key_value(file, s[S_CMD_T_TYPE], t->type);
     write_key_value(file, s[S_CMD_T_POSY], t->pos.y);
     write_key_value(file, s[S_CMD_T_POSX], t->pos.x);
@@ -346,7 +346,7 @@ extern void save_world()
     struct ThingAction * ta;
     for (ta = world.thing_actions; ta; ta = ta->next)
     {
-        write_key_value(file, s[S_CMD_THINGACTION], ta->id);
+        write_key_value(file, s[S_CMD_TA_ID], ta->id);
         write_key_value(file, s[S_CMD_TA_EFFORT], ta->effort);
         write_key_string(file, s[S_CMD_TA_NAME], ta->name);
         try_fputc('\n', file, __func__);
@@ -354,7 +354,7 @@ extern void save_world()
     struct ThingType * tt;
     for (tt = world.thing_types; tt; tt = tt->next)
     {
-        write_key_value(file, s[S_CMD_THINGTYPE], tt->id);
+        write_key_value(file, s[S_CMD_TT_ID], tt->id);
         write_key_value(file, s[S_CMD_TT_STARTN], tt->start_n);
         write_key_value(file, s[S_CMD_TT_HP], tt->lifepoints);
         int test = fprintf(file, "%s %c\n", s[S_CMD_TT_SYMB], tt->char_on_map);
@@ -365,7 +365,7 @@ extern void save_world()
     }
     for (tt = world.thing_types; tt; tt = tt->next)
     {
-        write_key_value(file, s[S_CMD_THINGTYPE], tt->id);
+        write_key_value(file, s[S_CMD_TT_ID], tt->id);
         write_key_value(file, s[S_CMD_TT_CORPS], tt->corpse_id);
     }
     try_fputc('\n', file, __func__);