ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/time.c
(Generate patch)

Comparing deliantra/server/server/time.c (file contents):
Revision 1.1.1.2 by elmex, Wed Feb 22 18:03:26 2006 UTC vs.
Revision 1.2 by root, Fri Feb 3 19:49:32 2006 UTC

1/* 1/*
2 * static char *rcsid_time_c = 2 * static char *rcsid_time_c =
3 * "$Id: time.c,v 1.1.1.2 2006/02/22 18:03:26 elmex Exp $"; 3 * "$Id: time.c,v 1.2 2006/02/03 19:49:32 root 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
94 /* Code below assumes the generator is on a map, as it tries 94 /* Code below assumes the generator is on a map, as it tries
95 * to place the monster on the map. So if the generator 95 * to place the monster on the map. So if the generator
96 * isn't on a map, complain and exit. 96 * isn't on a map, complain and exit.
97 */ 97 */
98 if (gen->map == NULL) { 98 if (gen->map == NULL) {
99 LOG(llevError,"Generator (%s) not on a map?\n", gen->name); 99 //LOG(llevError,"Generator (%s) not on a map?\n", gen->name);
100 return; 100 return;
101 } 101 }
102 /*First count numer of objects in inv*/ 102 /*First count numer of objects in inv*/
103 for (op=gen->inv;op;op=op->below) 103 for (op=gen->inv;op;op=op->below)
104 qty++; 104 qty++;
128 int i; 128 int i;
129 object *op,*head=NULL,*prev=NULL; 129 object *op,*head=NULL,*prev=NULL;
130 archetype *at=gen->other_arch; 130 archetype *at=gen->other_arch;
131 131
132 if(gen->other_arch==NULL) { 132 if(gen->other_arch==NULL) {
133 LOG(llevError,"Generator without other_arch: %s\n",gen->name); 133 //LOG(llevError,"Generator without other_arch: %s\n",gen->name);
134 return; 134 return;
135 } 135 }
136 /* Code below assumes the generator is on a map, as it tries 136 /* Code below assumes the generator is on a map, as it tries
137 * to place the monster on the map. So if the generator 137 * to place the monster on the map. So if the generator
138 * isn't on a map, complain and exit. 138 * isn't on a map, complain and exit.
139 */ 139 */
140 if (gen->map == NULL) { 140 if (gen->map == NULL) {
141 LOG(llevError,"Generator (%s) not on a map?\n", gen->name); 141 //LOG(llevError,"Generator (%s) not on a map?\n", gen->name);
142 return; 142 return;
143 } 143 }
144 i=find_free_spot(&at->clone,gen->map,gen->x,gen->y,1,9); 144 i=find_free_spot(&at->clone,gen->map,gen->x,gen->y,1,9);
145 if (i==-1) return; 145 if (i==-1) return;
146 while(at!=NULL) { 146 while(at!=NULL) {
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
1148void move_marker(object *op) { 1148void 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
1152 if(tmp->type == PLAYER) { /* we've got someone to MARK */ 1154 if(tmp->type == PLAYER) { /* we've got someone to MARK */
1153 1155
1154 if ( quest_on_activate(op, tmp->contr) ) 1156 if ( quest_on_activate(op, tmp->contr) )
1155 return; 1157 return;
1156 1158
1157 /* remove an old force with a slaying field == op->name */ 1159 /* remove an old force with a slaying field == op->name */
1158 for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) { 1160 for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) {
1159 if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->name)) break; 1161 if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->name)) break;
1160 } 1162 }
1161
1162 if(tmp2) { 1163 if(tmp2) {
1163 remove_ob(tmp2); 1164 remove_ob(tmp2);
1164 free_object(tmp2); 1165 free_object(tmp2);
1165 } 1166 }
1166 1167
1167 /* cycle through his inventory to look for the MARK we want to 1168 /* cycle through his inventory to look for the MARK we want to place */
1168 * place
1169 */
1170 for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) { 1169 for(tmp2=tmp->inv;tmp2 !=NULL; tmp2=tmp2->below) {
1171 if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->slaying)) break; 1170 if(tmp2->type == FORCE && tmp2->slaying && !strcmp(tmp2->slaying,op->slaying)) break;
1172 } 1171 }
1173 1172
1174 /* if we didn't find our own MARK */ 1173 /* if we didn't find our own MARK */
1175 if(tmp2==NULL) { 1174 if(tmp2==NULL) {
1175
1176 object *force = get_archetype(FORCE_NAME); 1176 object *force = get_archetype(FORCE_NAME);
1177
1178 force->speed = 0; 1177 force->speed = 0;
1179 if(op->stats.food) { 1178 if(op->stats.food) {
1180 force->speed = 0.01; 1179 force->speed = 0.01;
1181 force->speed_left = -op->stats.food; 1180 force->speed_left = -op->stats.food;
1182 } 1181 }
1183 update_ob_speed (force); 1182 update_ob_speed (force);
1184 /* put in the lock code */ 1183 /* put in the lock code */
1185 force->slaying = add_string(op->slaying); 1184 force->slaying = add_string(op->slaying);
1186 1185 if ( op->lore )
1187 if ( op->lore )
1188 force->lore = add_string( op->lore ); 1186 force->lore = add_string( op->lore );
1189
1190 insert_ob_in_ob(force,tmp); 1187 insert_ob_in_ob(force,tmp);
1191 if(op->msg) 1188 if(op->msg)
1192 new_draw_info(NDI_UNIQUE|NDI_NAVY,0,tmp,op->msg); 1189 new_draw_info(NDI_UNIQUE|NDI_NAVY,0,tmp,op->msg);
1193
1194 if(op->stats.hp > 0) { 1190 if(op->stats.hp > 0) {
1195 op->stats.hp--; 1191 op->stats.hp--;
1196 if(op->stats.hp==0) { 1192 if(op->stats.hp==0) {
1197 /* marker expires--granted mark number limit */ 1193 /* marker expires--granted mark number limit */
1198 remove_ob(op); 1194 remove_ob(op);
1199 free_object(op); 1195 free_object(op);
1200 return; 1196 return;
1201 } 1197 }
1202 } 1198 }
1203 } /* if tmp2 == NULL */ 1199 }
1204 } /* if tmp->type == PLAYER */ 1200
1205 } /* For all objects on this space */ 1201 }
1202
1203 }
1206} 1204}
1207 1205
1208int process_object(object *op) { 1206int process_object(object *op) {
1209 if (QUERY_FLAG(op, FLAG_IS_A_TEMPLATE)) 1207 if (QUERY_FLAG(op, FLAG_IS_A_TEMPLATE))
1210 return 0; 1208 return 0;
1245 return 1; 1243 return 1;
1246 } 1244 }
1247 /* Lauwenmark: Handle for plugin time event */ 1245 /* Lauwenmark: Handle for plugin time event */
1248 execute_event(op, EVENT_TIME,NULL,NULL,NULL,SCRIPT_FIX_NOTHING); 1246 execute_event(op, EVENT_TIME,NULL,NULL,NULL,SCRIPT_FIX_NOTHING);
1249 switch(op->type) { 1247 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
1259 case SPELL_EFFECT: 1248 case SPELL_EFFECT:
1260 move_spell_effect(op); 1249 move_spell_effect(op);
1261 return 1; 1250 return 1;
1262 1251
1263 case ROD: 1252 case ROD:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines