if(fieldPtr == NULL) return;
fieldPtr->GetSight(this->sightList, 12, this->position.GetX(), this->position.GetY());
-
- /*
- for(y = this->position.GetY() - 12; y <= this->position.GetY() + 12; y++)
- {
- for(x = this->position.GetX() - 12; y <= this->position.GetX() + 12; y++)
- {
- this->lore.PutFieldLore(0, x, y);
- }
- }
- */
-
- /*
- this->sight.clear();
- this->position.GetRoundRange(rangeVec, 0, 12);
- for(rangeIt = rangeVec.begin(); rangeIt != rangeVec.end(); rangeIt++)
- {
- if(fieldPtr->HaveSight(this->position.GetX(), this->position.GetY(), rangeIt->GetX(), rangeIt->GetY()))
- {
- this->lore.PutFieldLore(0, rangeIt->GetX(), rangeIt->GetY());
- this->sight[rangeIt->GetY()][rangeIt->GetX()] = true;
- }
- }
- */
}
void Creature::XMLSave(std::string filename)
{
MAP_LENGTH x, y, s;
int sideWidth = size * 2 + 1;
+ int allocSize = sideWidth * sideWidth;
std::vector<Coordinates> lineVec;
std::vector<Coordinates>::iterator lineIt;
std::vector<Coordinates>::reverse_iterator lineRIt;
- for(y = 0 ; y < size * 2 + 1; y++)
- {
- for(x = 0; x < size * 2 + 1; x++)
- {
- coordVec[y * sideWidth + x] = false;
- }
- }
+ for(s = 0 ; s < allocSize; s++) coordVec[s] = false;
+ coordVec[size * sideWidth + size] = true;
+
- for(s = size; s >= 0; s--)
+ for(s = size; s >= 1; s--)
{
for(x = baseX - s; x <= baseX + s; x++)
{
Coordinates::LineOfSight(lineVec, baseX, baseY, tx, ty1);
if(lineVec[0].GetX() == baseX && lineVec[0].GetY() == baseY)
{
- for(lineIt = lineVec.begin(); lineIt < lineVec.end(); lineIt++)
+ for(lineIt = ++lineVec.begin(); lineIt < lineVec.end(); lineIt++)
{
int lsx = lineIt->GetX() - baseX + size;
int lsy = lineIt->GetY() - baseY + size;
}
else
{
- for(lineRIt = lineVec.rbegin(); lineRIt < lineVec.rend(); lineRIt++)
+ for(lineRIt = ++lineVec.rbegin(); lineRIt < lineVec.rend(); lineRIt++)
{
int lsx = lineRIt->GetX() - baseX + size;
int lsy = lineRIt->GetY() - baseY + size;
Coordinates::LineOfSight(lineVec, baseX, baseY, tx, ty2);
if(lineVec[0].GetX() == baseX && lineVec[0].GetY() == baseY)
{
- for(lineIt = lineVec.begin(); lineIt < lineVec.end(); lineIt++)
+ for(lineIt = ++lineVec.begin()++; lineIt < lineVec.end(); lineIt++)
{
int lsx = lineIt->GetX() - baseX + size;
int lsy = lineIt->GetY() - baseY + size;
}
else
{
- for(lineRIt = lineVec.rbegin(); lineRIt < lineVec.rend(); lineRIt++)
+ for(lineRIt = ++lineVec.rbegin()++; lineRIt < lineVec.rend(); lineRIt++)
{
int lsx = lineRIt->GetX() - baseX + size;
int lsy = lineRIt->GetY() - baseY + size;
Coordinates::LineOfSight(lineVec, baseX, baseY, tx1, ty);
if(lineVec[0].GetX() == baseX && lineVec[0].GetY() == baseY)
{
- for(lineIt = lineVec.begin(); lineIt < lineVec.end(); lineIt++)
+ for(lineIt = ++lineVec.begin(); lineIt < lineVec.end(); lineIt++)
{
int lsx = lineIt->GetX() - baseX + size;
int lsy = lineIt->GetY() - baseY + size;
}
else
{
- for(lineRIt = lineVec.rbegin(); lineRIt < lineVec.rend(); lineRIt++)
+ for(lineRIt = ++lineVec.rbegin(); lineRIt < lineVec.rend(); lineRIt++)
{
int lsx = lineRIt->GetX() - baseX + size;
int lsy = lineRIt->GetY() - baseY + size;
Coordinates::LineOfSight(lineVec, baseX, baseY, tx2, ty);
if(lineVec[0].GetX() == baseX && lineVec[0].GetY() == baseY)
{
- for(lineIt = lineVec.begin(); lineIt < lineVec.end(); lineIt++)
+ for(lineIt = ++lineVec.begin(); lineIt < lineVec.end(); lineIt++)
{
int lsx = lineIt->GetX() - baseX + size;
int lsy = lineIt->GetY() - baseY + size;
}
else
{
- for(lineRIt = lineVec.rbegin(); lineRIt < lineVec.rend(); lineRIt++)
+ for(lineRIt = ++lineVec.rbegin(); lineRIt < lineVec.rend(); lineRIt++)
{
int lsx = lineRIt->GetX() - baseX + size;
int lsy = lineRIt->GetY() - baseY + size;
SDL_Rect floorSerfaceRect = {0, 0, squareGraphicWidth, squareGraphicHeight};
SDL_Surface *surface, *symbolSurface;
- //! @TTF\83t\83H\83\93\83g\82Ì\93Ç\82Ý\8d\9e\82Ý
+ //! @note TTF\83t\83H\83\93\83g\82Ì\93Ç\82Ý\8d\9e\82Ý
font = TTF_OpenFont("ttf\\ipam.ttf", 14);
fontSmall = TTF_OpenFont("ttf\\ipag.ttf", 9);
color.b = 200;
color.a = 255;
- if(!font)
+ if(!font || !fontSmall)
{
OutputDebugString(L"Failed: loading .ttf files.\n");
exit(1);
{
if(px < fieldPtr->GetWidth() && py < fieldPtr->GetHeight())
{
+ SDL_Rect blitRect = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth, 30 + (py - y) * squareGraphicHeight , squareGraphicWidth, squareGraphicHeight};
+ /*
SDL_Rect checkRect1 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 2 + 12, 30 + (py - y) * squareGraphicHeight - 2 + 12, 4, 4};
SDL_Rect checkRect2 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 2, 30 + (py - y) * squareGraphicHeight - 2, 4, 4};
SDL_Rect checkRect3 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 6 + 12, 30 + (py - y) * squareGraphicHeight - 1, 12, 2};
SDL_Rect checkRect4 = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth - 1, 30 + (py - y) * squareGraphicHeight - 6 + 12, 2, 12};
- SDL_Rect blitRect = {GameSurfaceSDL::sideBarWidth + (px - x) * squareGraphicWidth, 30 + (py - y) * squareGraphicHeight , squareGraphicWidth, squareGraphicHeight};
-/*
+
if(subJectCreaturePtr->GetLore()->GetFieldLore(0, px, py) > 0)
{
TAG tag = fieldPtr->GetSquare(px, py)->GetFloorTag();
SDL_BlitSurface(floorSurfaces[tag], &symbolRect, windowSurface, &blitRect);
if(subJectCreaturePtr->InSight(px, py) == false)
{
- SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, blitRect.x % 128 + squareGraphicWidth, blitRect.y % 128 + squareGraphicHeight};
+ SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, squareGraphicWidth, squareGraphicHeight};
SDL_BlitSurface(unseenFieldSurface, &fieldRect, windowSurface, &blitRect);
}
}
else
{
- SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, blitRect.x % 128 + squareGraphicWidth, blitRect.y % 128 + squareGraphicHeight};
+ SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, squareGraphicWidth, squareGraphicHeight};
SDL_BlitSurface(unknownFieldSurface, &fieldRect, windowSurface, &blitRect);
}
-*/
+ */
if(subJectCreaturePtr->InSight(px, py))
{
}
else
{
- SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, squareGraphicWidth, squareGraphicHeight};
+ //SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, squareGraphicWidth, squareGraphicHeight};
//SDL_FillRect(windowSurface, &fieldRect, SDL_MapRGBA(windowSurface->format, 255, 0, 0, 255));
- SDL_BlitSurface(unknownFieldSurface, &fieldRect, windowSurface, &blitRect);
+ //SDL_BlitSurface(unknownFieldSurface, &fieldRect, windowSurface, &blitRect);
}
+
/*
+
else
{
SDL_Rect fieldRect = {blitRect.x % 128, blitRect.y % 128, blitRect.x % 128 + squareGraphicWidth, blitRect.y % 128 + squareGraphicHeight};
bool GameWorld::GenerateCreature(std::map<TAG, boost::shared_ptr<Species>>::iterator& speciesIt, std::map<ID, boost::shared_ptr<Field>>::iterator& fieldIt, MAP_LENGTH x, MAP_LENGTH y)
{
+ std::map<ID, boost::shared_ptr<Creature>>::iterator creatureIt;
creatureList.emplace(this->creatureID, boost::make_shared<Creature>(speciesIt, fieldIt, x, y));
- creatureList[this->creatureID]->PlusWait(100, TRUE);
- creatureList[this->creatureID]->UpdateFieldLore();
+ creatureIt = creatureList.find(this->creatureID);
+ creatureIt->second->PlusWait(100, TRUE);
+ creatureIt->second->UpdateFieldLore();
do
{
this->creatureID++;