--- 8Kingdoms-1.1.0/ai/Diplomacy/diplomacy.cpp 2007-07-22 03:32:49.000000000 +0200 +++ kralovstvi/ai/Diplomacy/diplomacy.cpp 2007-08-27 07:28:48.000000000 +0200 @@ -245,7 +245,11 @@ void CDiplomacyEngine::setOtherRelationshipPropertiesByIDs(TRelationshipProperties & relshp_prop,int dip1,int dip2) { DiplomatRelations[dip1][dip2].relationship_properties.offer_seen_by_enemy=relshp_prop.offer_seen_by_enemy; + if (relshp_prop.belief>MAXIMAL_BELIEF) + relshp_prop.belief=MAXIMAL_BELIEF; DiplomatRelations[dip1][dip2].relationship_properties.belief=relshp_prop.belief; + if (relshp_prop.guess_belief>MAXIMAL_BELIEF) + relshp_prop.guess_belief=MAXIMAL_BELIEF; DiplomatRelations[dip1][dip2].relationship_properties.guess_belief=relshp_prop.guess_belief; } @@ -993,6 +997,11 @@ { if ((i!=dipid) && (DiplomatRecords[i].slotused)) { + // FOR SOME REASON belief can grow over MAXIMAL_BELIEF (tho it should not) - btw. the highest interval represents alliance + if (DiplomatRelations[dipid][i].relationship_properties.guess_belief>MAXIMAL_BELIEF) + DiplomatRelations[dipid][i].relationship_properties.guess_belief=MAXIMAL_BELIEF; + if (DiplomatRelations[dipid][i].relationship_properties.belief>MAXIMAL_BELIEF) + DiplomatRelations[dipid][i].relationship_properties.belief=MAXIMAL_BELIEF; TRelationship believedrs=getBeliefRelationship(DiplomatRelations[dipid][i].relationship_properties.belief); if (DiplomatRelations[dipid][i].rs!=believedrs) { --- 8Kingdoms-1.1.0/ai/ai_makra.h 2007-07-22 03:32:49.000000000 +0200 +++ kralovstvi/ai/ai_makra.h 2007-07-26 09:10:48.000000000 +0200 @@ -11,8 +11,8 @@ #ifndef __PETR_ZITA_AI_MAKRA__ #define __PETR_ZITA_AI_MAKRA__ -#define PRIORITY_AI_FLOODFILL 1 -#define PRIORITY_AI_ALLOC 1 +#define PRIORITY_AI_FLOODFILL 10 +#define PRIORITY_AI_ALLOC 10 /** Makro urcujici, zdali se ma volat tah umele inteligence - ma ciste ladici vyznam. */ #define AI_STRATEGIZER_ENABLED --- 8Kingdoms-1.1.0/common/rm/rmconf.cpp 2007-07-22 03:32:51.000000000 +0200 +++ kralovstvi/common/rm/rmconf.cpp 2007-07-26 09:10:34.000000000 +0200 @@ -108,7 +108,7 @@ if (retvalue!=0) // chyba pri cteni fajlu files.xml { GLOBALLOGID(PRIORITY_MISSING_FILE,"files.xml is missing or is damaged",XML_DIR); - THROW(E_8K_RM,"files.xml is corrupted"); + THROW(E_8K_RM,"files.xml cannot be found or is corrupted or is missing"); } // ziskani profilu --- 8Kingdoms-1.1.0/common/rm/rmmap.cpp 2007-07-22 03:32:51.000000000 +0200 +++ kralovstvi/common/rm/rmmap.cpp 2007-08-27 07:28:48.000000000 +0200 @@ -1855,6 +1855,12 @@ 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); 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); 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); + if ((*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief>10000) + { + printf("This should not occure!!"); + GLOBALLOGID(PRIORITY_FATAL,"Strange belief value role %i, belief %i",ii,(*this->mapsinfo[newtype])[this->idofmap]->roles[i]->relations[ii]->relationship_properties.belief); + } + 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); 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); } --- 8Kingdoms-1.1.0/common/xml/strda.cpp 2007-07-22 03:32:52.000000000 +0200 +++ kralovstvi/common/xml/strda.cpp 2007-08-16 18:26:32.000000000 +0200 @@ -25,10 +25,10 @@ size_t j=count; for (k=0;k *big,const char *smallstr,int terminate) @@ -38,10 +38,10 @@ size_t j=strlen(smallstr); for (k=0;k *big,const wchar_t *smallstr,int terminate) @@ -51,10 +51,10 @@ size_t j=wcslen(smallstr); for (k=0;k *big,const char *smallstr,int terminate) @@ -64,10 +64,10 @@ size_t j=strlen(smallstr); for (k=0;k0) // nema smysl se ptat na koren nebo neco co by melo byt nad { - int a; + size_t a; xmlcontainer * xc=0;// = (xmlcontainer*) KMemAlloc(sizeof(xmlcontainer)); int result=this->getTag(&xc,ids,tags,number); if ( (result!=XML_ERROR_NO_SUCH_A_PATH) && (xc!=NULL) && ((xc->content)!=NULL) && ((*(xc->content))[ids[number-1]]!=NULL) ) @@ -1964,7 +1964,7 @@ a=-1; if (size>0) // zjistim kam dat posledni 0 - tesne za vraceny retezec { - int n; + size_t n; if (a<(size-1)) n=a; else @@ -1976,7 +1976,7 @@ 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)) { // KMemFree(xc); - return (a); + return ((int)a); } else { @@ -1990,7 +1990,7 @@ } } -int TXMLdata::getData(char * data2,int size, char * firsttag, int firstid,...) +int TXMLdata::getData(char * data2,size_t size, char * firsttag, int firstid,...) // varci data urcena cestou { // v tuto chvili neni jeste dobre mit daTags v debug okne ;D ... neni to inicializovane @@ -2104,7 +2104,7 @@ { break; } - if ((result)>=size) // v result neni koncova 0 + if ((result)>=(int)size) // v result neni koncova 0 { if ((size!=0) && ((*data2)!=NULL)) KMemFree(*data2); @@ -2113,7 +2113,7 @@ done=-1; } else - done=size; + done=(int)size; } while (done==-1); } --- 8Kingdoms-1.1.0/common/xml/xml.h 2007-07-22 03:32:52.000000000 +0200 +++ kralovstvi/common/xml/xml.h 2007-08-16 18:26:33.000000000 +0200 @@ -124,7 +124,7 @@ @param firstid id prvniho nekorenoveho tagu na ceste k mistu kam se vklada @return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size) bez koncove 0 */ - int getData(char * data2,int size, char * firsttag,int firstid,...); + int getData(char * data2,size_t size, char * firsttag,int firstid,...); /** Ziska cely obsah tagu v podobe retezce. Posledni parametr musi byt NULL, strida se vzdy tag a jeho id. @@ -160,7 +160,7 @@ @param number delka cesty bez korenoveho tagu (take pocet prvku pole tags a ids) @return Vraci \ref XML_ERROR_NO_SUCH_A_PATH pokud cesta neexistuje, jinak delku obsahu tagu (nezavisle na size) */ - int getData(char * data2,int size,int *ids,char ** tags, int number); + int getData(char * data2,size_t size,int *ids,char ** tags, int number); /** Ziska okaz primo na data ulozena v xml. Tato funkce se musi pouzivat s opatrnosti pouze na cteni dat. Posledni parametr musi byt NULL. --- 8Kingdoms-1.1.0/net/comm.h 2007-07-22 03:32:59.000000000 +0200 +++ kralovstvi/net/comm.h 2007-08-16 18:26:57.000000000 +0200 @@ -194,7 +194,7 @@ int ping_time; /** Maximalni doba, po kterou se neprijal ping */ - int max_timeout; + unsigned int max_timeout; }; --- 8Kingdoms-1.1.0/net/queue.h 2007-07-22 03:32:59.000000000 +0200 +++ kralovstvi/net/queue.h 2007-08-16 18:26:57.000000000 +0200 @@ -32,7 +32,7 @@ char * data; ///< Vlasni data mysocket to; ///< Adresat struct TMessageBody * next; ///< Ukazatel na dalsi zpravu v seznamu - int part_sent; ///< Jak velka cast byla poslana + size_t part_sent; ///< Jak velka cast byla poslana size_t len; ///< Velikost }; --- 8Kingdoms-1.1.0/net/server.cpp 2007-07-22 03:32:59.000000000 +0200 +++ kralovstvi/net/server.cpp 2007-08-16 18:26:58.000000000 +0200 @@ -818,7 +818,7 @@ mysocket fd; j=0; int set=0; - int msglen3; + size_t msglen3; server.sin_family = AF_INET; server.sin_port = htons(80); server.sin_addr = *((struct in_addr *)he->h_addr); --- 8Kingdoms-1.1.0/world/players/player.cpp 2007-07-22 03:33:12.000000000 +0200 +++ kralovstvi/world/players/player.cpp 2007-08-27 07:28:48.000000000 +0200 @@ -72,6 +72,10 @@ if (_data->game_data.relations[i] != NULL) { package->setInt(_data->game_data.relations[i]->rs, "relations", 0, "relationship", i, "rs", 0, NULL); package->setInt(_data->game_data.relations[i]->offeredrs, "relations", 0, "relationship", i, "offeredrs", 0, NULL); + // this was missing!! + package->setInt(_data->game_data.relations[i]->relationship_properties.belief, "relations", 0, "relationship", i, "belief", 0, NULL); + package->setInt(_data->game_data.relations[i]->relationship_properties.offer_seen_by_enemy, "relations", 0, "relationship", i, "offer_seen_by_enemy", 0, NULL); + package->setInt(_data->game_data.relations[i]->relationship_properties.guess_belief, "relations", 0, "relationship", i, "guess_belief", 0, NULL); } } } @@ -119,6 +123,10 @@ _data->game_data.relations[i] = (ai_ns::diplomacy_ns::TDipRelation *)KMemAlloc(sizeof(ai_ns::diplomacy_ns::TDipRelation)); _data->game_data.relations[i]->rs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "rs", 0, NULL); _data->game_data.relations[i]->offeredrs = (ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "offeredrs", 0, NULL); + // this was missing!! + _data->game_data.relations[i]->relationship_properties.belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "belief", 0, NULL); + _data->game_data.relations[i]->relationship_properties.guess_belief=(ai_ns::diplomacy_ns::TRelationship)package->getInt("relations", 0, "relationship", i, "guess_belief", 0, NULL); + _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); } else { @@ -204,7 +212,7 @@ info[it->first]->stats = it->second->data().statistics; for (i = 1; i <= MAX_PLAYERS; i++) { if (it->second->data().game_data.relations[i]) { - *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]); + *(info[it->first]->relations[i]) = *(it->second->data().game_data.relations[i]); } else { info[it->first]->relations[i] = NULL; --- 8Kingdoms-1.1.0/world/world_engine.cpp 2007-07-22 03:33:12.000000000 +0200 +++ kralovstvi/world/world_engine.cpp 2007-08-03 21:22:13.000000000 +0200 @@ -1853,14 +1853,18 @@ // zaznamenam do statistik _world.players.townCaptured(town_occupied->new_player_id, town_occupied->former_player_id); - // dam o tom vedet diplomacii - if (former_player_id != 0) { - TPacket_Diplomacy_ConquerCity conquerCity; - conquerCity.attacked_diplomat_world_id = former_player_id; - conquerCity.attacking_diplomat_world_id = new_player_id; - conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME; + // if the player is not dead or was not neutral, inform Diplomacy + if (former_player_id != 0) + { + if (_world.players[former_player_id]->data().game_data.state != PS_DEFEATED) + { + TPacket_Diplomacy_ConquerCity conquerCity; + conquerCity.attacked_diplomat_world_id = former_player_id; + conquerCity.attacking_diplomat_world_id = new_player_id; + conquerCity.payment = _world.towns[town_id]->data().citysize * TOWN_INCOME; - KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity); + KSendGlobalMessage(MSG_DIPLOMACY_CONQUER_CITY, MOD_WORLD_SERVER, MOD_DIPLOMACY, &conquerCity); + } } }