projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Abstract away the operations involving a sentinel value for coordinates.
[super-star-trek.git]
/
src
/
setup.c
diff --git
a/src/setup.c
b/src/setup.c
index b254a548ff2fa2df5d8c85cd175044c011f8e033..44e378b28dcaae0a25da6a1dade0c4b13734baa9 100644
(file)
--- a/
src/setup.c
+++ b/
src/setup.c
@@
-175,8
+175,8
@@
static void setup_names(void)
/* Sets up some arrays with localized names.
* Must be done after iostart() for localization to work. */
{
/* Sets up some arrays with localized names.
* Must be done after iostart() for localization to work. */
{
- char *tmp1[] = SYSTEM_NAMES;
- char *tmp2[] = DEVICE_NAMES;
+ char *tmp1[
ARRAY_SIZE(systnames)
] = SYSTEM_NAMES;
+ char *tmp2[
ARRAY_SIZE(device)
] = DEVICE_NAMES;
memcpy(systnames, tmp1, sizeof(systnames));
memcpy(device, tmp2, sizeof(device));
memcpy(systnames, tmp1, sizeof(systnames));
memcpy(device, tmp2, sizeof(device));
@@
-212,7
+212,7
@@
void setup(bool needprompt)
for (i=0; i < NDEVICES; i++)
game.damage[i] = 0.0;
// Set up assorted game parameters
for (i=0; i < NDEVICES; i++)
game.damage[i] = 0.0;
// Set up assorted game parameters
-
game.battle.x = game.battle.y = 0
;
+
invalidate(game.battle)
;
game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
game.iscate = game.resting = game.imine = game.icrystl = game.icraft = false;
game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
game.iscate = game.resting = game.imine = game.icrystl = game.icraft = false;
@@
-274,12
+274,12
@@
void setup(bool needprompt)
if (distq < 6.0*(BASEMAX+1-game.inbase) && Rand() < 0.75) {
contflag = true;
if (idebug)
if (distq < 6.0*(BASEMAX+1-game.inbase) && Rand() < 0.75) {
contflag = true;
if (idebug)
- prout(
_("=== Abandoning base #%d at %d-%d")
, i, w.x, w.y);
+ prout(
"=== Abandoning base #%d at %d-%d"
, i, w.x, w.y);
break;
}
else if (distq < 6.0 * (BASEMAX+1-game.inbase)) {
if (idebug)
break;
}
else if (distq < 6.0 * (BASEMAX+1-game.inbase)) {
if (idebug)
- prout(
_("=== Saving base #%d, close to #%d")
, i, j);
+ prout(
"=== Saving base #%d, close to #%d"
, i, j);
}
}
} while (contflag);
}
}
} while (contflag);
@@
-324,7
+324,8
@@
void setup(bool needprompt)
game.state.galaxy[w.x][w.y].klingons > 8);
// check for duplicate
for (j = 1; j < i; j++)
game.state.galaxy[w.x][w.y].klingons > 8);
// check for duplicate
for (j = 1; j < i; j++)
- if (game.state.kcmdr[j].x==w.x && game.state.kcmdr[j].y==w.y) break;
+ if (same(game.state.kcmdr[j], w))
+ break;
} while (j < i);
game.state.galaxy[w.x][w.y].klingons++;
game.state.kcmdr[i] = w;
} while (j < i);
game.state.galaxy[w.x][w.y].klingons++;
game.state.kcmdr[i] = w;
@@
-336,12
+337,12
@@
void setup(bool needprompt)
game.state.plnets[i].w = w;
if (i < NINHAB) {
game.state.plnets[i].pclass = M; // All inhabited planets are class M
game.state.plnets[i].w = w;
if (i < NINHAB) {
game.state.plnets[i].pclass = M; // All inhabited planets are class M
- game.state.plnets[i].crystals =
0
;
+ game.state.plnets[i].crystals =
absent
;
game.state.plnets[i].known = known;
game.state.plnets[i].inhabited = i;
} else {
game.state.plnets[i].pclass = Rand()*3.0; // Planet class M N or O
game.state.plnets[i].known = known;
game.state.plnets[i].inhabited = i;
} else {
game.state.plnets[i].pclass = Rand()*3.0; // Planet class M N or O
- game.state.plnets[i].crystals =
1.5*Rand()
; // 1 in 3 chance of crystals
+ game.state.plnets[i].crystals =
Rand()*1.5
; // 1 in 3 chance of crystals
game.state.plnets[i].known = unknown;
game.state.plnets[i].inhabited = UNINHABITED;
}
game.state.plnets[i].known = unknown;
game.state.plnets[i].inhabited = UNINHABITED;
}
@@
-365,7
+366,7
@@
void setup(bool needprompt)
thing = randplace(GALSIZE);
}
else
thing = randplace(GALSIZE);
}
else
-
thing.x = thing.y = 0
;
+
invalidate(thing)
;
skip(2);
game.state.snap = false;
skip(2);
game.state.snap = false;
@@
-407,7
+408,7
@@
void setup(bool needprompt)
waitfor();
newqad(false);
if (game.nenhere-iqhere-game.ithere) game.shldup = true;
waitfor();
newqad(false);
if (game.nenhere-iqhere-game.ithere) game.shldup = true;
- if (game.neutz) attack(
0);
// bad luck to start in a Romulan Neutral Zone
+ if (game.neutz) attack(
false);
// bad luck to start in a Romulan Neutral Zone
}
bool choose(bool needprompt)
}
bool choose(bool needprompt)
@@
-560,12
+561,11
@@
void newqad(bool shutup)
coord w;
struct quadrant *q;
coord w;
struct quadrant *q;
- game.iattak = 1;
game.justin = true;
game.justin = true;
-
game.base.x = game.base.y = 0
;
+
invalidate(game.base)
;
game.klhere = 0;
game.comhere = false;
game.klhere = 0;
game.comhere = false;
-
game.plnet.x = game.plnet.y = 0
;
+
invalidate(game.plnet)
;
game.ishere = false;
game.irhere = 0;
game.iplnet = 0;
game.ishere = false;
game.irhere = 0;
game.iplnet = 0;