X-Git-Url: https://git.distorted.org.uk/~mdw/rocl/blobdiff_plain/aabaeb15526146e041e474775ab0d96e024dd3c2..4041fdd8af852bf6fb4db0aa6ddd2c8c2f640574:/elite.c diff --git a/elite.c b/elite.c index 8c7aeee..e6e90f2 100644 --- a/elite.c +++ b/elite.c @@ -1,40 +1,27 @@ /* -*-c-*- * - * $Id: elite.c,v 1.2 2003/03/07 00:43:50 mdw Exp $ - * * Elite planet data * * (c) 2003 Mark Wooding */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: elite.c,v $ - * Revision 1.2 2003/03/07 00:43:50 mdw - * Move adjacency map stuff to C for performance reasons. - * - * Revision 1.1 2003/02/24 01:13:12 mdw - * Initial import. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -114,7 +101,7 @@ static void world_us(Tcl_Obj *o) o->bytes = p; o->length = 12; for (i = 0; i < 6; i++, p += 2) - sprintf(p, "%02x", w->x[i]); + sprintf(p, "%02x", w->x[i]); } static void world_dir(Tcl_Obj *o, Tcl_Obj *oo) @@ -326,7 +313,7 @@ static void goatsoup(Tcl_Obj *d, const char *pn, world *w, const char *p) p++; j = mangle(w); goatsoup(d, pn, w, desc[i][(j >= 0x33) + (j >= 0x66) + - (j >= 0x99) + (j >= 0xcc)]); + (j >= 0x99) + (j >= 0xcc)]); break; case '%': p++; @@ -375,7 +362,7 @@ static int cmd_worldinfo(ClientData cd, Tcl_Interp *ti, world ww; /* --- Check arguments --- */ - + if (objc != 3) return (err(ti, "usage: elite-worldinfo ARR SEED")); if ((w = world_get(ti, objv[2])) == 0) @@ -390,15 +377,15 @@ static int cmd_worldinfo(ClientData cd, Tcl_Interp *ti, TCL_LEAVE_ERR_MSG) || !Tcl_SetVar2Ex(ti, arr, "y", Tcl_NewIntObj(wi.y * 2), TCL_LEAVE_ERR_MSG) || - !Tcl_SetVar2Ex(ti, arr, "government", Tcl_NewIntObj(wi.gov), + !Tcl_SetVar2Ex(ti, arr, "government", Tcl_NewIntObj(wi.gov), TCL_LEAVE_ERR_MSG) || !Tcl_SetVar2Ex(ti, arr, "economy", Tcl_NewIntObj(wi.eco), TCL_LEAVE_ERR_MSG) || - !Tcl_SetVar2Ex(ti, arr, "techlevel", Tcl_NewIntObj(wi.tech), + !Tcl_SetVar2Ex(ti, arr, "techlevel", Tcl_NewIntObj(wi.tech), TCL_LEAVE_ERR_MSG) || - !Tcl_SetVar2Ex(ti, arr, "population", Tcl_NewIntObj(wi.pop), + !Tcl_SetVar2Ex(ti, arr, "population", Tcl_NewIntObj(wi.pop), TCL_LEAVE_ERR_MSG) || - !Tcl_SetVar2Ex(ti, arr, "productivity", Tcl_NewIntObj(wi.prod), + !Tcl_SetVar2Ex(ti, arr, "productivity", Tcl_NewIntObj(wi.prod), TCL_LEAVE_ERR_MSG) || !Tcl_SetVar2Ex(ti, arr, "radius", Tcl_NewIntObj(wi.rad), TCL_LEAVE_ERR_MSG) || @@ -711,7 +698,7 @@ static int put_items(Tcl_Interp *ti, /*const*/ char *arr, return (-1); *p++ = ii; } - return (0); + return (0); } static struct cmddata cmdtab[] = { @@ -927,7 +914,7 @@ static int cmd_adjacency(ClientData cd, Tcl_Interp *ti, goto done; } for (i = 0; i < oc; i += 3) { - s = Tcl_GetString(ov[i]); + s = Tcl_GetString(ov[i]); Tcl_CreateHashEntry(&done, s, &dummy); if (Tcl_GetLongFromObj(ti, ov[i + 1], &x) != TCL_OK || Tcl_GetLongFromObj(ti, ov[i + 2], &y) != TCL_OK) @@ -988,7 +975,7 @@ int Elite_SafeInit(Tcl_Interp *ti) } cmds[] = { { "elite-nextworld", cmd_nextworld }, { "elite-nextgalaxy", cmd_nextgalaxy }, - { "elite-worldinfo", cmd_worldinfo }, + { "elite-worldinfo", cmd_worldinfo }, { "elite-market", cmd_market }, { "elite-unpackcmdr", cmd_unpackcmdr }, { "elite-packcmdr", cmd_packcmdr },