MCPcopy Create free account
hub / github.com/SimHacker/micropolis / checkBigZone

Function checkBigZone

MicropolisCore/src/MicropolisEngine/src/tool.cpp:394–519  ·  view source on GitHub ↗

* Compute where the 'center' (at (1,1)) of the zone is, depending on where the * user clicked. * * Only inner tiles are recognized, and possibly not even complete (ie stadium * while game is playing). * * @param id Tile character value of the tile that the user clicked on. * @param deltaHPtr Pointer where horizontal position correction is written to. * @param deltaVPtr Pointer where vertic

Source from the content-addressed store, hash-verified

392 * @todo Make this table driven.
393 */
394static short checkBigZone(MapTile id, short *deltaHPtr, short *deltaVPtr)
395{
396 switch (id) {
397
398 case POWERPLANT: /* check coal plant */
399 case PORT: /* check sea port */
400 case NUCLEAR: /* check nuc plant */
401 case STADIUM: /* check stadium */
402 *deltaHPtr = 0;
403 *deltaVPtr = 0;
404 return 4;
405
406 case POWERPLANT + 1: /* check coal plant */
407 case COALSMOKE3: /* check coal plant, smoke */
408 case COALSMOKE3 + 1: /* check coal plant, smoke */
409 case COALSMOKE3 + 2: /* check coal plant, smoke */
410 case PORT + 1: /* check sea port */
411 case NUCLEAR + 1: /* check nuc plant */
412 case STADIUM + 1: /* check stadium */
413 *deltaHPtr = -1;
414 *deltaVPtr = 0;
415 return 4;
416
417 case POWERPLANT + 4: /* check coal plant */
418 case PORT + 4: /* check sea port */
419 case NUCLEAR + 4: /* check nuc plant */
420 case STADIUM + 4: /* check stadium */
421 *deltaHPtr = 0;
422 *deltaVPtr = -1;
423 return 4;
424
425 case POWERPLANT + 5: /* check coal plant */
426 case PORT + 5: /* check sea port */
427 case NUCLEAR + 5: /* check nuc plant */
428 case STADIUM + 5: /* check stadium */
429 *deltaHPtr = -1;
430 *deltaVPtr = -1;
431 return 4;
432
433 case AIRPORT: /* check airport */
434 *deltaHPtr = 0;
435 *deltaVPtr = 0;
436 return 6;
437
438 case AIRPORT + 1:
439 *deltaHPtr = -1;
440 *deltaVPtr = 0;
441 return 6;
442
443 case AIRPORT + 2:
444 *deltaHPtr = -2;
445 *deltaVPtr = 0;
446 return 6;
447
448 case AIRPORT + 3:
449 *deltaHPtr = -3;
450 *deltaVPtr = 0;
451 return 6;

Callers 1

bulldozerToolMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected