/[pkgs]/devel/8Kingdoms/8Kingdoms-1.1.0-cvs-fixes.patch
ViewVC logotype

Contents of /devel/8Kingdoms/8Kingdoms-1.1.0-cvs-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Fri Jan 4 20:05:23 2008 UTC (22 months, 3 weeks ago) by jwrdegoede
Branch: MAIN
CVS Tags: Kingdoms-1_1_0-6_fc9, Kingdoms-1_1_0-5_fc9, F-10-split, Kingdoms-1_1_0-7_fc11, Kingdoms-1_1_0-4_fc9, F-9-split, HEAD
File MIME type: text/x-patch
* Fri Jan  4 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 1.1.0-4
- Fix divide by zero abort (bz 427485)
- Backport various fixes from CVS
- Note this still won't work with tcl 8.5, this release is just to keep
  rawhide in sync with F-8 / F-7
1 --- 8Kingdoms-1.1.0/ai/Diplomacy/diplomacy.cpp 2007-07-22 03:32:49.000000000 +0200
2 +++ kralovstvi/ai/Diplomacy/diplomacy.cpp 2007-08-27 07:28:48.000000000 +0200
3 @@ -245,7 +245,11 @@
4 void CDiplomacyEngine::setOtherRelationshipPropertiesByIDs(TRelationshipProperties & relshp_prop,int dip1,int dip2)
5 {
6 DiplomatRelations[dip1][dip2].relationship_properties.offer_seen_by_enemy=relshp_prop.offer_seen_by_enemy;
7 + if (relshp_prop.belief>MAXIMAL_BELIEF)
8 + relshp_prop.belief=MAXIMAL_BELIEF;
9 DiplomatRelations[dip1][dip2].relationship_properties.belief=relshp_prop.belief;
10 + if (relshp_prop.guess_belief>MAXIMAL_BELIEF)
11 + relshp_prop.guess_belief=MAXIMAL_BELIEF;
12 DiplomatRelations[dip1][dip2].relationship_properties.guess_belief=relshp_prop.guess_belief;
13 }
14
15 @@ -993,6 +997,11 @@
16 {
17 if ((i!=dipid) && (DiplomatRecords[i].slotused))
18 {
19 + // FOR SOME REASON belief can grow over MAXIMAL_BELIEF (tho it should not) - btw. the highest interval <ALLY_TRUCE_BORDER,MAXIMAL_BELIEF> represents alliance
20 + if (DiplomatRelations[dipid][i].relationship_properties.guess_belief>MAXIMAL_BELIEF)
21 + DiplomatRelations[dipid][i].relationship_properties.guess_belief=MAXIMAL_BELIEF;
22 + if (DiplomatRelations[dipid][i].relationship_properties.belief>MAXIMAL_BELIEF)
23 + DiplomatRelations[dipid][i].relationship_properties.belief=MAXIMAL_BELIEF;
24 TRelationship believedrs=getBeliefRelationship(DiplomatRelations[dipid][i].relationship_properties.belief);
25 if (DiplomatRelations[dipid][i].rs!=believedrs)
26 {
27 --- 8Kingdoms-1.1.0/ai/ai_makra.h 2007-07-22 03:32:49.000000000 +0200
28 +++ kralovstvi/ai/ai_makra.h 2007-07-26 09:10:48.000000000 +0200
29 @@ -11,8 +11,8 @@
30 #ifndef __PETR_ZITA_AI_MAKRA__
31 #define __PETR_ZITA_AI_MAKRA__
32
33 -#define PRIORITY_AI_FLOODFILL 1
34 -#define PRIORITY_AI_ALLOC 1
35 +#define PRIORITY_AI_FLOODFILL 10
36 +#define PRIORITY_AI_ALLOC 10
37
38 /** Makro urcujici, zdali se ma volat tah umele inteligence - ma ciste ladici vyznam. */
39 #define AI_STRATEGIZER_ENABLED
40 --- 8Kingdoms-1.1.0/common/rm/rmconf.cpp 2007-07-22 03:32:51.000000000 +0200
41 +++ kralovstvi/common/rm/rmconf.cpp 2007-07-26 09:10:34.000000000 +0200
42 @@ -108,7 +108,7 @@
43 if (retvalue!=0) // chyba pri cteni fajlu files.xml
44 {
45 GLOBALLOGID(PRIORITY_MISSING_FILE,"files.xml is missing or is damaged",XML_DIR);
46 - THROW(E_8K_RM,"files.xml is corrupted");
47 + THROW(E_8K_RM,"files.xml cannot be found or is corrupted or is missing");
48 }
49
50 // ziskani profilu
51 --- 8Kingdoms-1.1.0/common/rm/rmmap.cpp 2007-07-22 03:32:51.000000000 +0200
52 +++ kralovstvi/common/rm/rmmap.cpp 2007-08-27 07:28:48.000000000 +0200
53 @@ -1855,6 +1855,12 @@
54 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->rs,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"state",0,NULL);
55 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->offeredrs,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"offered",0,NULL);
56 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.offer_seen_by_enemy,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"delivered",0,NULL);
57 + if ((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief>10000)
58 + {
59 + printf("This should not occure!!");
60 + GLOBALLOGID(PRIORITY_FATAL,"Strange belief value role %i, belief %i",ii,(*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief);
61 + }
62 +
63 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"belief",0,NULL);
64 newmap.setDataInt((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.guess_belief,"header",0,"roles",0,"role",i,"relations",0,"role",ii,"guessBelief",0,NULL);
65 }
66 --- 8Kingdoms-1.1.0/common/xml/strda.cpp 2007-07-22 03:32:52.000000000 +0200
67 +++ kralovstvi/common/xml/strda.cpp 2007-08-16 18:26:32.000000000 +0200
68 @@ -25,10 +25,10 @@
69 size_t j=count;
70 for (k=0;k<j;k++)
71 {
72 - (*big)[i+k]=smallstr[k];
73 + (*big)[(int)(i+k)]=smallstr[(int)k];
74 }
75 if (terminate)
76 - (*big)[i+k]=0;
77 + (*big)[(int)(i+k)]=0;
78 }
79
80 void addtoda(DA<char> *big,const char *smallstr,int terminate)
81 @@ -38,10 +38,10 @@
82 size_t j=strlen(smallstr);
83 for (k=0;k<j;k++)
84 {
85 - (*big)[i+k]=smallstr[k];
86 + (*big)[(int)(i+k)]=smallstr[(int)k];
87 }
88 if (terminate)
89 - (*big)[i+k]=0;
90 + (*big)[(int)(i+k)]=0;
91 }
92
93 void addtodawcs(DA<wchar_t> *big,const wchar_t *smallstr,int terminate)
94 @@ -51,10 +51,10 @@
95 size_t j=wcslen(smallstr);
96 for (k=0;k<j;k++)
97 {
98 - (*big)[i+k]=smallstr[k];
99 + (*big)[(int)(i+k)]=smallstr[(int)k];
100 }
101 if (terminate)
102 - (*big)[i+k]=0;
103 + (*big)[(int)(i+k)]=0;
104 }
105
106 void addtodastr(DA<char> *big,const char *smallstr,int terminate)
107 @@ -64,10 +64,10 @@
108 size_t j=strlen(smallstr);
109 for (k=0;k<j;k++)
110 {
111 - (*big)[i+k]=smallstr[k];
112 + (*big)[(int)(i+k)]=smallstr[(int)k];
113 }
114 if (terminate)
115 - (*big)[i+k]=0;
116 + (*big)[(int)(i+k)]=0;
117 }
118
119 void addtostr(char **big,const char *smallstr,int terminate)
120 @@ -77,10 +77,10 @@
121 size_t j=strlen(smallstr);
122 for (k=0;k<j;k++)
123 {
124 - (*big)[i+k]=smallstr[k];
125 + (*big)[(int)(i+k)]=smallstr[(int)k];
126 }
127 if (terminate)
128 - (*big)[i+k]=0;
129 + (*big)[(int)(i+k)]=0;
130 }
131
132 size_t newandstrcpy(char ** output, const char * input)
133 --- 8Kingdoms-1.1.0/common/xml/xml.cpp 2007-07-22 03:32:52.000000000 +0200
134 +++ kralovstvi/common/xml/xml.cpp 2007-08-16 18:26:33.000000000 +0200
135 @@ -1939,12 +1939,12 @@
136 }
137
138
139 -int TXMLdata::getData(char * data2,int size,int *ids,char ** tags, int number)
140 +int TXMLdata::getData(char * data2,size_t size,int *ids,char ** tags, int number)
141 // getData tentokrat s argumenty pole
142 {
143 if (number>0) // nema smysl se ptat na koren nebo neco co by melo byt nad
144 {
145 - int a;
146 + size_t a;
147 xmlcontainer * xc=0;// = (xmlcontainer*) KMemAlloc(sizeof(xmlcontainer));
148 int result=this->getTag(&xc,ids,tags,number);
149 if ( (result!=XML_ERROR_NO_SUCH_A_PATH) && (xc!=NULL) && ((xc->content)!=NULL) && ((*(xc->content))[ids[number-1]]!=NULL) )
150 @@ -1964,7 +1964,7 @@
151 a=-1;
152 if (size>0) // zjistim kam dat posledni 0 - tesne za vraceny retezec
153 {
154 - int n;
155 + size_t n;
156 if (a<(size-1))
157 n=a;
158 else
159 @@ -1976,7 +1976,7 @@
160 if ( (result!=XML_ERROR_NO_SUCH_A_PATH) && (xc!=NULL) && ((xc->content)!=NULL) && ((*(xc->content))[ids[number-1]]!=NULL) && (xc->content!=NULL) && ((*(xc->content))[ids[number-1]]->data!=NULL))
161 {
162 // KMemFree(xc);
163 - return (a);
164 + return ((int)a);
165 }
166 else
167 {
168 @@ -1990,7 +1990,7 @@
169 }
170 }
171
172 -int TXMLdata::getData(char * data2,int size, char * firsttag, int firstid,...)
173 +int TXMLdata::getData(char * data2,size_t size, char * firsttag, int firstid,...)
174 // varci data urcena cestou
175 {
176 // v tuto chvili neni jeste dobre mit daTags v debug okne ;D ... neni to inicializovane
177 @@ -2104,7 +2104,7 @@
178 {
179 break;
180 }
181 - if ((result)>=size) // v result neni koncova 0
182 + if ((result)>=(int)size) // v result neni koncova 0
183 {
184 if ((size!=0) && ((*data2)!=NULL))
185 KMemFree(*data2);
186 @@ -2113,7 +2113,7 @@
187 done=-1;
188 }
189 else
190 - done=size;
191 + done=(int)size;
192 } while (done==-1);
193 }
194
195 --- 8Kingdoms-1.1.0/common/xml/xml.h 2007-07-22 03:32:52.000000000 +0200
196 +++ kralovstvi/common/xml/xml.h 2007-08-16 18:26:33.000000000 +0200
197 @@ -124,7 +124,7 @@
198 @param firstid id prvniho nekorenoveho tagu na ceste k mistu kam se vklada
199 @return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size) bez koncove 0
200 */
201 - int getData(char * data2,int size, char * firsttag,int firstid,...);
202 + int getData(char * data2,size_t size, char * firsttag,int firstid,...);
203
204 /** Ziska cely obsah tagu v podobe retezce.
205 Posledni parametr musi byt NULL, strida se vzdy tag a jeho id.
206 @@ -160,7 +160,7 @@
207 @param number delka cesty bez korenoveho tagu (take pocet prvku pole tags a ids)
208 @return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size)
209 */
210 - int getData(char * data2,int size,int *ids,char ** tags, int number);
211 + int getData(char * data2,size_t size,int *ids,char ** tags, int number);
212
213 /** Ziska okaz primo na data ulozena v xml.
214 Tato funkce se musi pouzivat s opatrnosti pouze na cteni dat. Posledni parametr musi byt NULL.
215 --- 8Kingdoms-1.1.0/net/comm.h 2007-07-22 03:32:59.000000000 +0200
216 +++ kralovstvi/net/comm.h 2007-08-16 18:26:57.000000000 +0200
217 @@ -194,7 +194,7 @@
218 int ping_time;
219
220 /** Maximalni doba, po kterou se neprijal ping */
221 - int max_timeout;
222 + unsigned int max_timeout;
223
224 };
225
226 --- 8Kingdoms-1.1.0/net/queue.h 2007-07-22 03:32:59.000000000 +0200
227 +++ kralovstvi/net/queue.h 2007-08-16 18:26:57.000000000 +0200
228 @@ -32,7 +32,7 @@
229 char * data; ///< Vlasni data
230 mysocket to; ///< Adresat
231 struct TMessageBody * next; ///< Ukazatel na dalsi zpravu v seznamu
232 - int part_sent; ///< Jak velka cast byla poslana
233 + size_t part_sent; ///< Jak velka cast byla poslana
234 size_t len; ///< Velikost
235 };
236
237 --- 8Kingdoms-1.1.0/net/server.cpp 2007-07-22 03:32:59.000000000 +0200
238 +++ kralovstvi/net/server.cpp 2007-08-16 18:26:58.000000000 +0200
239 @@ -818,7 +818,7 @@
240 mysocket fd;
241 j=0;
242 int set=0;
243 - int msglen3;
244 + size_t msglen3;
245 server.sin_family = AF_INET;
246 server.sin_port = htons(80);
247 server.sin_addr = *((struct in_addr *)he->h_addr);
248 --- 8Kingdoms-1.1.0/world/players/player.cpp 2007-07-22 03:33:12.000000000 +0200
249 +++ kralovstvi/world/players/player.cpp 2007-08-27 07:28:48.000000000 +0200
250 @@ -72,6 +72,10 @@
251 if (_data->game_data.relations[i] != NULL) {
252 package->setInt(_data->game_data.relations[i]->rs, "relations", 0, "relationship", i, "rs", 0, NULL);
253 package->setInt(_data->game_data.relations[i]->offeredrs, "relations", 0, "relationship", i, "offeredrs", 0, NULL);
254 + // this was missing!!
255 + package->setInt(_data->game_data.relations[i]->relationship_properties.belief, "relations", 0, "relationship", i, "belief", 0, NULL);
256 + package->setInt(_data->game_data.relations[i]->relationship_properties.offer_seen_by_enemy, "relations", 0, "relationship", i, "offer_seen_by_enemy", 0, NULL);
257 + package->setInt(_data->game_data.relations[i]->relationship_properties.guess_belief, "relations", 0, "relationship", i, "guess_belief", 0, NULL);
258 }
259 }
260 }
261 @@ -119,6 +123,10 @@
262 _data->game_data.relations[i] = (ai_ns::diplomacy_ns::TDipRelation *)KMemAlloc(sizeof(ai_ns::diplomacy_ns::TDipRelation));
263 _data->game_data.relations[i]->rs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "rs", 0, NULL);
264 _data->game_data.relations[i]->offeredrs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "offeredrs", 0, NULL);
265 + // this was missing!!
266 + _data->game_data.relations[i]->relationship_properties.belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "belief", 0, NULL);
267 + _data->game_data.relations[i]->relationship_properties.guess_belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "guess_belief", 0, NULL);
268 + _data->game_data.relations[i]->relationship_properties.offer_seen_by_enemy=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "offer_seen_by_enemy", 0, NULL);
269
270 }
271 else {
272 @@ -204,7 +212,7 @@
273 info[it->first]->stats = it->second->data().statistics;
274 for (i = 1; i <= MAX_PLAYERS; i++) {
275 if (it->second->data().game_data.relations[i]) {
276 - *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]);
277 + *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]);
278 }
279 else {
280 info[it->first]->relations[i] = NULL;
281 --- 8Kingdoms-1.1.0/world/world_engine.cpp 2007-07-22 03:33:12.000000000 +0200
282 +++ kralovstvi/world/world_engine.cpp 2007-08-03 21:22:13.000000000 +0200
283 @@ -1853,14 +1853,18 @@
284 // zaznamenam do statistik
285 _world.players.townCaptured(town_occupied->new_player_id, town_occupied->former_player_id);
286
287 - // dam o tom vedet diplomacii
288 - if (former_player_id != 0) {
289 - TPacket_Diplomacy_ConquerCity conquerCity;
290 - conquerCity.attacked_diplomat_world_id = former_player_id;
291 - conquerCity.attacking_diplomat_world_id = new_player_id;
292 - conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME;
293 + // if the player is not dead or was not neutral, inform Diplomacy
294 + if (former_player_id != 0)
295 + {
296 + if (_world.players[former_player_id]->data().game_data.state != PS_DEFEATED)
297 + {
298 + TPacket_Diplomacy_ConquerCity conquerCity;
299 + conquerCity.attacked_diplomat_world_id = former_player_id;
300 + conquerCity.attacking_diplomat_world_id = new_player_id;
301 + conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME;
302
303 - KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity);
304 + KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity);
305 + }
306 }
307 }
308

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2