MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003060VCMIAI - Adventure Mappublic2019-05-16 09:022019-05-21 14:45
Reportermpech 
Assigned ToDydzio 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
PlatformUbuntu 16.04.6 LTSOSOS Version
Product Version 
Target VersionFixed in Version1.next 
Summary0003060: core in CMap.cpp::getTile
Descriptionhi,

mods:
- witchkings artifacts
- hota
- death valley
- retreat
- preserve town

running develop (aee4bb728) 9May


console output
```
vcmiserver: /media/data/mpech/dl/vcmi/lib/mapping/CMap.cpp:390: TerrainTile& CMap::getTile(const int3&): Assertion `isInTheMap(tile)' failed.
vcmiclient: /media/data/mpech/dl/vcmi/lib/mapping/CMap.cpp:390: TerrainTile& CMap::getTile(const int3&): Assertion `isInTheMap(tile)' failed.
Aborted (core dumped)
```


backtrace:
```
0000002 0x00007f589431dbd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7f5896363c21 "isInTheMap(tile)",
    file=file@entry=0x7f5896363b28 "/media/data/mpech/dl/vcmi/lib/mapping/CMap.cpp", line=line@entry=390,
    function=function@entry=0x7f58963645c0 <CMap::getTile(int3 const&)::__PRETTY_FUNCTION__> "TerrainTile& CMap::getTile(const int3&)") at assert.c:92
0000003 0x00007f589431dc82 in __GI___assert_fail (assertion=assertion@entry=0x7f5896363c21 "isInTheMap(tile)",
    file=file@entry=0x7f5896363b28 "/media/data/mpech/dl/vcmi/lib/mapping/CMap.cpp", line=line@entry=390,
    function=function@entry=0x7f58963645c0 <CMap::getTile(int3 const&)::__PRETTY_FUNCTION__> "TerrainTile& CMap::getTile(const int3&)")
    at assert.c:101
0000004 0x00007f5895f8426d in CMap::getTile (this=0x7f588478e290, tile=...) at /media/data/mpech/dl/vcmi/lib/mapping/CMap.cpp:390
0000005 0x00007f589632931f in NewObject::applyGs (this=this@entry=0x7f588bffeb00, gs=gs@entry=0x7f5884787880)
    at /media/data/mpech/dl/vcmi/lib/NetPacksLib.cpp:679
0000006 0x00007f58962767af in CApplyOnGS<NewObject>::applyOnGS (this=<optimized out>, gs=0x7f5884787880, pack=0x7f588bffeb00)
    at /media/data/mpech/dl/vcmi/lib/CGameState.cpp:63
0000007 0x00007f589625f24e in CGameState::apply (this=0x7f5884787880, pack=pack@entry=0x7f588bffeb00) at /media/data/mpech/dl/vcmi/lib/CGameState.cpp:1968
0000008 0x0000000000444a2d in CGameHandler::sendAndApply (this=0x7f588402b8f0, pack=0x7f588bffeb00)
```

Steps To Reproduce
load attached save, end turn
TagsNo tags attached.
Attached Fileszip file icon getTile.zip [^] (1,727,436 bytes) 2019-05-16 09:02

- Relationships

-  Notes
(0007788)
mpech (reporter)
2019-05-16 11:15

looking a bit further:
wrong offset is pos.x == 144 (==width)

> CApplyOnGS<NewObject>::applyOnGS
wrong CApplyOnGS<NewObject> for which pos.x == 144 holds Obj ID ==8

problematic Obj ID == 8 maps to CGameHandler::buildBoat and indeed adding
```
    int3 tile2 = tile + int3(1,0,0);
    if (!gs->map->isInTheMap(tile2))
    {
        complain("ISUCK");
        return false;
    }
```

does complain

error occurs because in attached screenshot, shipyard lies on the almost border of the map.
bestLocation may (not checked) return the tile (143,0,0) which is at the utmost limit (x axis) of the map but line
> no.pos = tile + int3(1,0,0);
makes the generated boat go out of the map

code seem to be old and there must be a reason I don't understand why we add int3(1,0,0) to the bestLocation()??
(0007789)
mpech (reporter)
2019-05-16 13:04
edited on: 2019-05-16 13:04

I ended up modifying CObjectHandler.cpp so I can play

```
IBoatGenerator::EGeneratorState IBoatGenerator::shipyardStatus() const
{
    int3 tile = bestLocation();
    const TerrainTile *t = IObjectInterface::cb->getTile(tile);
    if(!t)
        return TILE_BLOCKED; //no available water
    else if (!o->cb->gameState()->map->isInTheMap(tile+int3(1,0,0))) // poor code dupe from CGameHandler.cpp
        return TILE_BLOCKED;

```
but propagating the (1,0,0)offset seem rather rather ugly

(0007792)
Dydzio (developer)
2019-05-18 17:42

Fixed in: https://github.com/vcmi/vcmi/pull/591 [^]

- Issue History
Date Modified Username Field Change
2019-05-16 09:02 mpech New Issue
2019-05-16 09:02 mpech File Added: getTile.zip
2019-05-16 11:15 mpech Note Added: 0007788
2019-05-16 13:04 mpech Note Added: 0007789
2019-05-16 13:04 mpech Note Edited: 0007789 View Revisions
2019-05-16 13:04 mpech Note Edited: 0007789 View Revisions
2019-05-18 17:36 Dydzio Assigned To => Dydzio
2019-05-18 17:36 Dydzio Status new => assigned
2019-05-18 17:42 Dydzio Note Added: 0007792
2019-05-21 14:45 Dydzio Status assigned => resolved
2019-05-21 14:45 Dydzio Fixed in Version => 1.next
2019-05-21 14:45 Dydzio Resolution open => fixed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean