1 | /* |
1 | /* |
2 | * static char *rcsid_time_c = |
2 | * static char *rcsid_time_c = |
3 | * "$Id: time.c,v 1.1.1.1 2006/02/03 07:14:41 root Exp $"; |
3 | * "$Id: time.c,v 1.1.1.2 2006/02/22 18:03:26 elmex Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
1144 | field to the player. The marker will decrement hp to |
1144 | field to the player. The marker will decrement hp to |
1145 | 0 and then delete itself every time it grants a mark. |
1145 | 0 and then delete itself every time it grants a mark. |
1146 | unless hp was zero to start with, in which case it is infinite.*/ |
1146 | unless hp was zero to start with, in which case it is infinite.*/ |
1147 | |
1147 | |
1148 | void move_marker(object *op) { |
1148 | void move_marker(object *op) { |
1149 | object *tmp,*tmp2; |
1149 | object *tmp,*tmp2; |
1150 | |
1150 | |
1151 | for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) { |
1151 | for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) { |
1152 | |
|
|
1153 | |
|
|
1154 | if(tmp->type == PLAYER) { /* we've got someone to MARK */ |
1152 | if(tmp->type == PLAYER) { /* we've got someone to MARK */ |
1155 | |
1153 | |
1156 | if ( quest_on_activate(op, tmp->contr) ) |
1154 | if ( quest_on_activate(op, tmp->contr) ) |
1157 | return; |
1155 | return; |
1158 | |
1156 | |
1159 | /* remove an old force with a slaying field == op->name */ |
1157 | /* remove an old force with a slaying field == op->name */ |
1160 | for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) { |
1158 | for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) { |
1161 | if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->name)) break; |
1159 | if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->name)) break; |
1162 | } |
1160 | } |
|
|
1161 | |
1163 | if(tmp2) { |
1162 | if(tmp2) { |
1164 | remove_ob(tmp2); |
1163 | remove_ob(tmp2); |
1165 | free_object(tmp2); |
1164 | free_object(tmp2); |
|
|
1165 | } |
|
|
1166 | |
|
|
1167 | /* cycle through his inventory to look for the MARK we want to |
|
|
1168 | * place |
|
|
1169 | */ |
|
|
1170 | for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) { |
|
|
1171 | if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->slaying)) break; |
|
|
1172 | } |
|
|
1173 | |
|
|
1174 | /* if we didn't find our own MARK */ |
|
|
1175 | if(tmp2==NULL) { |
|
|
1176 | object *force = get_archetype(FORCE_NAME); |
|
|
1177 | |
|
|
1178 | force->speed = 0; |
|
|
1179 | if(op->stats.food) { |
|
|
1180 | force->speed = 0.01; |
|
|
1181 | force->speed_left = -op->stats.food; |
1166 | } |
1182 | } |
1167 | |
|
|
1168 | /* cycle through his inventory to look for the MARK we want to place */ |
|
|
1169 | for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) { |
|
|
1170 | if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->slaying)) break; |
|
|
1171 | } |
|
|
1172 | |
|
|
1173 | /* if we didn't find our own MARK */ |
|
|
1174 | if(tmp2==NULL) { |
|
|
1175 | |
|
|
1176 | object *force = get_archetype(FORCE_NAME); |
|
|
1177 | force->speed = 0; |
|
|
1178 | if(op->stats.food) { |
|
|
1179 | force->speed = 0.01; |
|
|
1180 | force->speed_left = -op->stats.food; |
|
|
1181 | } |
|
|
1182 | update_ob_speed (force); |
1183 | update_ob_speed (force); |
1183 | /* put in the lock code */ |
1184 | /* put in the lock code */ |
1184 | force->slaying = add_string(op->slaying); |
1185 | force->slaying = add_string(op->slaying); |
1185 | if ( op->lore ) |
1186 | |
|
|
1187 | if ( op->lore ) |
1186 | force->lore = add_string( op->lore ); |
1188 | force->lore = add_string( op->lore ); |
|
|
1189 | |
1187 | insert_ob_in_ob(force,tmp); |
1190 | insert_ob_in_ob(force,tmp); |
1188 | if(op->msg) |
1191 | if(op->msg) |
1189 | new_draw_info(NDI_UNIQUE|NDI_NAVY,0,tmp,op->msg); |
1192 | new_draw_info(NDI_UNIQUE|NDI_NAVY,0,tmp,op->msg); |
|
|
1193 | |
1190 | if(op->stats.hp > 0) { |
1194 | if(op->stats.hp > 0) { |
1191 | op->stats.hp--; |
1195 | op->stats.hp--; |
1192 | if(op->stats.hp==0) { |
1196 | if(op->stats.hp==0) { |
1193 | /* marker expires--granted mark number limit */ |
1197 | /* marker expires--granted mark number limit */ |
1194 | remove_ob(op); |
1198 | remove_ob(op); |
1195 | free_object(op); |
1199 | free_object(op); |
1196 | return; |
1200 | return; |
1197 | } |
1201 | } |
1198 | } |
1202 | } |
1199 | } |
1203 | } /* if tmp2 == NULL */ |
1200 | |
1204 | } /* if tmp->type == PLAYER */ |
1201 | } |
1205 | } /* For all objects on this space */ |
1202 | |
|
|
1203 | } |
|
|
1204 | } |
1206 | } |
1205 | |
1207 | |
1206 | int process_object(object *op) { |
1208 | int process_object(object *op) { |
1207 | if (QUERY_FLAG(op, FLAG_IS_A_TEMPLATE)) |
1209 | if (QUERY_FLAG(op, FLAG_IS_A_TEMPLATE)) |
1208 | return 0; |
1210 | return 0; |
… | |
… | |
1243 | return 1; |
1245 | return 1; |
1244 | } |
1246 | } |
1245 | /* Lauwenmark: Handle for plugin time event */ |
1247 | /* Lauwenmark: Handle for plugin time event */ |
1246 | execute_event(op, EVENT_TIME,NULL,NULL,NULL,SCRIPT_FIX_NOTHING); |
1248 | execute_event(op, EVENT_TIME,NULL,NULL,NULL,SCRIPT_FIX_NOTHING); |
1247 | switch(op->type) { |
1249 | switch(op->type) { |
|
|
1250 | case TRANSPORT: |
|
|
1251 | /* Transports are directed by players - thus, there |
|
|
1252 | * speed is reduced when the player moves them about. |
|
|
1253 | * So give them back there speed here, since process_objects() |
|
|
1254 | * has decremented it. |
|
|
1255 | */ |
|
|
1256 | if (op->speed_left < 0.0) op->speed_left += 1.0; |
|
|
1257 | return 1; |
|
|
1258 | |
1248 | case SPELL_EFFECT: |
1259 | case SPELL_EFFECT: |
1249 | move_spell_effect(op); |
1260 | move_spell_effect(op); |
1250 | return 1; |
1261 | return 1; |
1251 | |
1262 | |
1252 | case ROD: |
1263 | case ROD: |