00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <config.h>
00035
00036 #include "commodity.h"
00037 #include "file.h"
00038 #include "land.h"
00039 #include "loan.h"
00040 #include "misc.h"
00041 #include "nat.h"
00042 #include "nsc.h"
00043 #include "nuke.h"
00044 #include "plane.h"
00045 #include "player.h"
00046 #include "prototypes.h"
00047 #include "sect.h"
00048 #include "ship.h"
00049 #include "trade.h"
00050 #include "xy.h"
00051
00052
00053
00054
00055
00056
00057 int
00058 check_sect_ok(struct sctstr *sectp)
00059 {
00060 struct sctstr chksect;
00061 struct sctstr tsect;
00062
00063 getsect(sectp->sct_x, sectp->sct_y, &chksect);
00064 memcpy(&tsect, sectp, sizeof(struct sctstr));
00065 tsect.sct_timestamp = chksect.sct_timestamp = 0;
00066 if (memcmp(&tsect, &chksect, sizeof(struct sctstr))) {
00067 pr("Sector %s has changed!\n",
00068 xyas(sectp->sct_x, sectp->sct_y, player->cnum));
00069 return 0;
00070 }
00071 return 1;
00072 }
00073
00074 int
00075 check_ship_ok(struct shpstr *shipp)
00076 {
00077 struct shpstr chkship;
00078 struct shpstr tship;
00079
00080 getship(shipp->shp_uid, &chkship);
00081 memcpy(&tship, shipp, sizeof(struct shpstr));
00082 tship.shp_timestamp = chkship.shp_timestamp = 0;
00083 if (memcmp(&tship, &chkship, sizeof(struct shpstr))) {
00084 pr("Ship #%d has changed!\n", shipp->shp_uid);
00085 return 0;
00086 }
00087 return 1;
00088 }
00089
00090 int
00091 check_plane_ok(struct plnstr *planep)
00092 {
00093 struct plnstr chkplane;
00094 struct plnstr tplane;
00095
00096 getplane(planep->pln_uid, &chkplane);
00097 memcpy(&tplane, planep, sizeof(struct plnstr));
00098 tplane.pln_timestamp = chkplane.pln_timestamp = 0;
00099 if (memcmp(&tplane, &chkplane, sizeof(struct plnstr))) {
00100 pr("Plane #%d has changed!\n", planep->pln_uid);
00101 return 0;
00102 }
00103 return 1;
00104 }
00105
00106 int
00107 check_land_ok(struct lndstr *landp)
00108 {
00109 struct lndstr chkland;
00110 struct lndstr tland;
00111
00112 getland(landp->lnd_uid, &chkland);
00113 memcpy(&tland, landp, sizeof(struct lndstr));
00114 tland.lnd_timestamp = chkland.lnd_timestamp = 0;
00115 if (memcmp(&tland, &chkland, sizeof(struct lndstr))) {
00116 pr("Land unit #%d has changed!\n", landp->lnd_uid);
00117 return 0;
00118 }
00119 return 1;
00120 }
00121
00122 int
00123 check_nuke_ok(struct nukstr *nukep)
00124 {
00125 struct nukstr chknuke;
00126 struct nukstr tnuke;
00127
00128 getnuke(nukep->nuk_uid, &chknuke);
00129 memcpy(&tnuke, nukep, sizeof(struct nukstr));
00130 tnuke.nuk_timestamp = chknuke.nuk_timestamp = 0;
00131 if (memcmp(&tnuke, &chknuke, sizeof(struct nukstr))) {
00132 pr("Nuke %d has changed!\n", nukep->nuk_uid);
00133 return 0;
00134 }
00135 return 1;
00136 }
00137
00138 int
00139 check_loan_ok(struct lonstr *loanp)
00140 {
00141 struct lonstr chkloan;
00142
00143 getloan(loanp->l_uid, &chkloan);
00144 if (memcmp(loanp, &chkloan, sizeof(struct lonstr))) {
00145 pr("Loan %d has changed!\n", loanp->l_uid);
00146 return 0;
00147 }
00148 return 1;
00149 }
00150
00151 int
00152 check_comm_ok(struct comstr *commp)
00153 {
00154 struct comstr chkcomm;
00155
00156 getcomm(commp->com_uid, &chkcomm);
00157 if (memcmp(commp, &chkcomm, sizeof(struct comstr))) {
00158 pr("Commodity %d has changed!\n", commp->com_uid);
00159 return 0;
00160 }
00161 return 1;
00162 }
00163
00164 int
00165 check_trade_ok(struct trdstr *tp)
00166 {
00167 struct trdstr chktrade;
00168
00169 gettrade(tp->trd_uid, &chktrade);
00170 if (memcmp(tp, &chktrade, sizeof(struct trdstr))) {
00171 pr("Trade lot #%d has changed!\n", tp->trd_uid);
00172 return 0;
00173 }
00174 return 1;
00175 }