Mihael Peklar avatar Mihael Peklar committed c5c5154 Draft

Made units change speed based on the type of tiles they are on.

Comments (0)

Files changed (4)

+double GM_Battle::getTileSpeed(float x, float y)
+	return this->map->tileSpeed(this->map->findTile(x, y));
 void GM_Battle::_paintSelector(float _x, float _y, float w, float h)
 	void handleEvent(SDL_Event &event);
 	void removeUnit(Unit*);
 	Pathfinder* getPathfinder() ;
+	double getTileSpeed(float x, float y);
 	Unit* selectedUnit;
 #Start tile data:
 #define SGN(x) ((x) ? (x)/(x) : 0)
-extern GameMode* game;
+#define mygame ((GM_Battle*)game)
-	this->pathfinder = ((GM_Battle*)game)->getPathfinder(); //TODO: There has to be a better way to do this!
+	this->pathfinder = mygame->getPathfinder(); //TODO: There has to be a better way to do this!
 	this->tex = TextureManager::getInstance()->getTexture("zombie.png");
 	this->attacking_tex = TextureManager::getInstance()->getTexture("zombie_attacking.png");
 			float dY = this->activeOrder.details.move.dsty - this->activeOrder.details.move.srcy;
-			this->activeOrder.details.move.progress += speed * k;
+			this->activeOrder.details.move.progress += speed * k*mygame->getTileSpeed(this->x, this->y);
 			float len = sqrt(dX * dX + dY * dY);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.