From: Christian Heller Date: Thu, 24 Jul 2014 02:33:06 +0000 (+0200) Subject: Server: Rename thing, thing type and thing action selection commands. X-Git-Tag: tce~694 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%22https:/validator.w3.org/ledger?a=commitdiff_plain;h=adff1bfac0cebdccbc321e6704951c9fce2ab1e1;p=plomrogue Server: Rename thing, thing type and thing action selection commands. --- diff --git a/confserver/world b/confserver/world index a399aee..0c26815 100644 --- a/confserver/world +++ b/confserver/world @@ -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 diff --git a/src/server/god_commands.c b/src/server/god_commands.c index 02c091a..2962d4c 100644 --- a/src/server/god_commands.c +++ b/src/server/god_commands.c @@ -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."; diff --git a/src/server/hardcoded_strings.c b/src/server/hardcoded_strings.c index 6ad856b..e9578c7 100644 --- a/src/server/hardcoded_strings.c +++ b/src/server/hardcoded_strings.c @@ -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"; } diff --git a/src/server/hardcoded_strings.h b/src/server/hardcoded_strings.h index fd9ceb8..2783290 100644 --- a/src/server/hardcoded_strings.h +++ b/src/server/hardcoded_strings.h @@ -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 }; diff --git a/src/server/io.c b/src/server/io.c index 17110d3..f6d6928 100644 --- a/src/server/io.c +++ b/src/server/io.c @@ -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__);