Originally posted by Martin Gühmann
Than I can assume this, too. However I looked into the source code and it seemed that there they are filled in prperly. It might be a general problem with location and unit arraies in the message boxes. But that is a little bit hard to figure out. However you could figure out whether putting an army into the slic context works.
Than I can assume this, too. However I looked into the source code and it seemed that there they are filled in prperly. It might be a general problem with location and unit arraies in the message boxes. But that is a little bit hard to figure out. However you could figure out whether putting an army into the slic context works.
Yes, we still need translators. By the way did you try the robot translation on my German text bit? Have some fun with robot translation.
Not really a custom ResourceDB, however there is some kind of resource map that contains good prbabilities or prices or whatever. That might be recomputed.
EDIT: I think this might be it, it gets all the resources from the terrainDB and not the resourceDB right? Should add all the tileImp enablesgood too or am I off? I left the other code below.
Code:
sint32 Cell::GetGoodsIndex(sint32 &val) const { val = (m_env & k_MASK_ENV_GOOD); if (val == 0) { return FALSE; } else { val >>= k_SHIFT_ENV_GOOD; val--; while(val >= 0 && (g_theTerrainDB->Get(m_terrain_type)->GetNumResources() <= val)) { val--; } if(val < 0) return FALSE; return TRUE; } }
Code:
WrlEnv.cpp //------------------------------------------------------------------------ ---- // // Name : World::GetGood // // Description: Checks whether the given location has a good. // // Parameters : const MapPoint &pos: Map position which should be checked, // whether it has a good. // sint32 &good: Filled with the good database index // of the good at the map position. // // Globals : g_theTerrainDB: The terrain database. // // Returns : Whether the given location has a good. // // Remark(s) : - // //------------------------------------------------------------------------ ---- BOOL World::GetGood(const MapPoint &pos, sint32 &good) const { sint32 i; Cell *c = GetCell(pos); if (c->GetGoodsIndex(i)) { good= g_theTerrainDB->Get(c->m_terrain_type)->GetResourcesIndex( i); return TRUE; } else { return FALSE; } } //------------------------------------------------------------------------ ---- // // Name : World::GetGood // // Description: Checks whether the given location has a good. // // Parameters : Cell *cell: Pointer on the cell for which should be checked, // whether it has a good. // sint32 &good: Filled with the good database index of the good // in the cell. // // Globals : g_theTerrainDB: The terrain database. // // Returns : Whether the given location has a good. // // Remark(s) : - // //------------------------------------------------------------------------ ---- BOOL World::GetGood(const Cell *c, sint32 &good) const { sint32 i; if (c->GetGoodsIndex(i)) { good= g_theTerrainDB->Get(c->m_terrain_type)->GetResourcesIndex( i); return TRUE; } else { return FALSE; } } void World::ClearGoods(const sint32 x, const sint32 y) { m_map[x][y]->m_env &= ~k_MASK_ENV_GOOD ; } void World::SetGood(const sint32 x, const sint32 y, const sint32 g) { Assert(0<= x); Assert(xAccess(m_map[x][y]->m_terrain_type)->Get NumResources() <= g -1) return; switch(g) { case 0: m_map[x][y]->m_env &= ~k_MASK_ENV_GOOD; break; case 1: m_map[x][y]->m_env = (m_map[x][y]->m_env & ~k_MASK_ENV_GOOD) | k_BIT_ENV_GOOD1; break; case 2: m_map[x][y]->m_env = (m_map[x][y]->m_env & ~k_MASK_ENV_GOOD) | k_BIT_ENV_GOOD2; break; case 3: m_map[x][y]->m_env = (m_map[x][y]->m_env & ~k_MASK_ENV_GOOD) | k_BIT_ENV_GOOD3; break; case 4: m_map[x][y]->m_env = (m_map[x][y]->m_env & ~k_MASK_ENV_GOOD) | k_BIT_ENV_GOOD4; break; default: Assert(0); } #ifdef _DEBUG #endif } void World::SetRandomGood(const sint32 x, const sint32 y) { double totalProb = 0; double prob[k_MAX_GOODS_TYPES_PER_TERRAIN]; Cell *cell = m_map[x][y]; sint32 i; for(i = 0; i < k_MAX_GOODS_TYPES_PER_TERRAIN; i++) { if(g_theTerrainDB->Get(cell->m_terrain_type)->GetNumResour ces() > i) { prob[i] = g_theTerrainDB->Get(cell->m_terrain_type)->GetResources(i)- >GetProbability(); totalProb += prob[i]; } else { prob[i] = 0; } } Assert(totalProb <= 1.0); totalProb = 0; sint32 val = g_rand->Next(1000); for(i = 0; i < k_MAX_GOODS_TYPES_PER_TERRAIN; i++) { if(val < (totalProb + prob[i]) * 1000) { SetGood(x,y,i+1); return; } totalProb += prob[i]; } }
Comment