equal
deleted
inserted
replaced
156 cp->sign.left + (cp->sign.width_1 << 2) + 12, |
156 cp->sign.left + (cp->sign.width_1 << 2) + 12, |
157 cp->sign.top + 48); |
157 cp->sign.top + 48); |
158 } |
158 } |
159 |
159 |
160 // Called after load to update coordinates |
160 // Called after load to update coordinates |
161 void AfterLoadVehicles() |
161 void AfterLoadVehicles(void) |
162 { |
162 { |
163 Vehicle *v; |
163 Vehicle *v; |
164 Waypoint *cp; |
164 Waypoint *cp; |
165 |
165 |
166 FOR_ALL_VEHICLES(v) { |
166 FOR_ALL_VEHICLES(v) { |
200 */ |
200 */ |
201 v->random_bits = InteractiveRandomRange(256); |
201 v->random_bits = InteractiveRandomRange(256); |
202 return v; |
202 return v; |
203 } |
203 } |
204 |
204 |
205 Vehicle *ForceAllocateSpecialVehicle() |
205 Vehicle *ForceAllocateSpecialVehicle(void) |
206 { |
206 { |
207 Vehicle *v; |
207 Vehicle *v; |
208 FOR_ALL_VEHICLES_FROM(v, NUM_NORMAL_VEHICLES) { |
208 FOR_ALL_VEHICLES_FROM(v, NUM_NORMAL_VEHICLES) { |
209 if (v->type == 0) |
209 if (v->type == 0) |
210 return InitializeVehicle(v); |
210 return InitializeVehicle(v); |
211 } |
211 } |
212 return NULL; |
212 return NULL; |
213 |
213 |
214 } |
214 } |
215 |
215 |
216 Vehicle *ForceAllocateVehicle() |
216 Vehicle *ForceAllocateVehicle(void) |
217 { |
217 { |
218 Vehicle *v; |
218 Vehicle *v; |
219 FOR_ALL_VEHICLES(v) { |
219 FOR_ALL_VEHICLES(v) { |
220 if (v->index >= NUM_NORMAL_VEHICLES) |
220 if (v->index >= NUM_NORMAL_VEHICLES) |
221 return NULL; |
221 return NULL; |
224 return InitializeVehicle(v); |
224 return InitializeVehicle(v); |
225 } |
225 } |
226 return NULL; |
226 return NULL; |
227 } |
227 } |
228 |
228 |
229 Vehicle *AllocateVehicle() |
229 Vehicle *AllocateVehicle(void) |
230 { |
230 { |
231 Vehicle *v; |
231 Vehicle *v; |
232 int num; |
232 int num; |
233 |
233 |
234 if (IS_HUMAN_PLAYER(_current_player)) { |
234 if (IS_HUMAN_PLAYER(_current_player)) { |
325 v->next_hash = *new_hash; |
325 v->next_hash = *new_hash; |
326 *new_hash = v->index; |
326 *new_hash = v->index; |
327 } |
327 } |
328 } |
328 } |
329 |
329 |
330 void InitializeVehicles() |
330 void InitializeVehicles(void) |
331 { |
331 { |
332 Vehicle *v; |
332 Vehicle *v; |
333 int i; |
333 int i; |
334 |
334 |
335 // clear it... |
335 // clear it... |
383 do count++; while ( (v=v->next) != NULL); |
383 do count++; while ( (v=v->next) != NULL); |
384 return count; |
384 return count; |
385 } |
385 } |
386 |
386 |
387 |
387 |
388 Depot *AllocateDepot() |
388 Depot *AllocateDepot(void) |
389 { |
389 { |
390 Depot *dep, *free_dep = NULL; |
390 Depot *dep, *free_dep = NULL; |
391 int num_free = 0; |
391 int num_free = 0; |
392 |
392 |
393 for(dep = _depots; dep != endof(_depots); dep++) { |
393 for(dep = _depots; dep != endof(_depots); dep++) { |
405 } |
405 } |
406 |
406 |
407 return free_dep; |
407 return free_dep; |
408 } |
408 } |
409 |
409 |
410 Waypoint *AllocateWaypoint() |
410 Waypoint *AllocateWaypoint(void) |
411 { |
411 { |
412 Waypoint *cp; |
412 Waypoint *cp; |
413 |
413 |
414 for(cp = _waypoints; cp != endof(_waypoints); cp++) { |
414 for(cp = _waypoints; cp != endof(_waypoints); cp++) { |
415 if (cp->xy == 0) |
415 if (cp->xy == 0) |
483 Aircraft_Tick, |
483 Aircraft_Tick, |
484 EffectVehicle_Tick, |
484 EffectVehicle_Tick, |
485 DisasterVehicle_Tick, |
485 DisasterVehicle_Tick, |
486 }; |
486 }; |
487 |
487 |
488 void CallVehicleTicks() |
488 void CallVehicleTicks(void) |
489 { |
489 { |
490 Vehicle *v; |
490 Vehicle *v; |
491 |
491 |
492 FOR_ALL_VEHICLES(v) { |
492 FOR_ALL_VEHICLES(v) { |
493 if (v->type != 0) |
493 if (v->type != 0) |
1979 _special_desc, |
1979 _special_desc, |
1980 _disaster_desc, |
1980 _disaster_desc, |
1981 }; |
1981 }; |
1982 |
1982 |
1983 // Will be called when the vehicles need to be saved. |
1983 // Will be called when the vehicles need to be saved. |
1984 static void Save_VEHS() |
1984 static void Save_VEHS(void) |
1985 { |
1985 { |
1986 Vehicle *v; |
1986 Vehicle *v; |
1987 // Write the vehicles |
1987 // Write the vehicles |
1988 FOR_ALL_VEHICLES(v) { |
1988 FOR_ALL_VEHICLES(v) { |
1989 if (v->type != 0) { |
1989 if (v->type != 0) { |
1992 } |
1992 } |
1993 } |
1993 } |
1994 } |
1994 } |
1995 |
1995 |
1996 // Will be called when vehicles need to be loaded. |
1996 // Will be called when vehicles need to be loaded. |
1997 static void Load_VEHS() |
1997 static void Load_VEHS(void) |
1998 { |
1998 { |
1999 int index; |
1999 int index; |
2000 Vehicle *v; |
2000 Vehicle *v; |
2001 |
2001 |
2002 while ((index = SlIterateArray()) != -1) { |
2002 while ((index = SlIterateArray()) != -1) { |
2062 SLE_VAR(Depot,xy, SLE_UINT16), |
2062 SLE_VAR(Depot,xy, SLE_UINT16), |
2063 SLE_VAR(Depot,town_index, SLE_UINT16), |
2063 SLE_VAR(Depot,town_index, SLE_UINT16), |
2064 SLE_END() |
2064 SLE_END() |
2065 }; |
2065 }; |
2066 |
2066 |
2067 static void Save_DEPT() |
2067 static void Save_DEPT(void) |
2068 { |
2068 { |
2069 Depot *d; |
2069 Depot *d; |
2070 int i; |
2070 int i; |
2071 for(i=0,d=_depots; i!=lengthof(_depots); i++,d++) { |
2071 for(i=0,d=_depots; i!=lengthof(_depots); i++,d++) { |
2072 if (d->xy != 0) { |
2072 if (d->xy != 0) { |
2074 SlObject(d, _depot_desc); |
2074 SlObject(d, _depot_desc); |
2075 } |
2075 } |
2076 } |
2076 } |
2077 } |
2077 } |
2078 |
2078 |
2079 static void Load_DEPT() |
2079 static void Load_DEPT(void) |
2080 { |
2080 { |
2081 int index; |
2081 int index; |
2082 while ((index = SlIterateArray()) != -1) { |
2082 while ((index = SlIterateArray()) != -1) { |
2083 SlObject(&_depots[index], _depot_desc); |
2083 SlObject(&_depots[index], _depot_desc); |
2084 } |
2084 } |
2093 SLE_CONDVAR(Waypoint, stat_id, SLE_UINT8, 3, 255), |
2093 SLE_CONDVAR(Waypoint, stat_id, SLE_UINT8, 3, 255), |
2094 |
2094 |
2095 SLE_END() |
2095 SLE_END() |
2096 }; |
2096 }; |
2097 |
2097 |
2098 static void Save_CHKP() |
2098 static void Save_CHKP(void) |
2099 { |
2099 { |
2100 Waypoint *cp; |
2100 Waypoint *cp; |
2101 int i; |
2101 int i; |
2102 for(i=0,cp=_waypoints; i!=lengthof(_waypoints); i++,cp++) { |
2102 for(i=0,cp=_waypoints; i!=lengthof(_waypoints); i++,cp++) { |
2103 if (cp->xy != 0) { |
2103 if (cp->xy != 0) { |
2105 SlObject(cp, _waypoint_desc); |
2105 SlObject(cp, _waypoint_desc); |
2106 } |
2106 } |
2107 } |
2107 } |
2108 } |
2108 } |
2109 |
2109 |
2110 static void Load_CHKP() |
2110 static void Load_CHKP(void) |
2111 { |
2111 { |
2112 int index; |
2112 int index; |
2113 while ((index = SlIterateArray()) != -1) { |
2113 while ((index = SlIterateArray()) != -1) { |
2114 SlObject(&_waypoints[index], _waypoint_desc); |
2114 SlObject(&_waypoints[index], _waypoint_desc); |
2115 } |
2115 } |