Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon May 29, 2017 11:00 pm

All times are UTC




Post new topic  Reply to topic  [ 75 posts ]  Go to page 1 2 3 4 Next
Author Message
PostPosted: Sat Jan 06, 2007 6:55 pm 
Offline
Engineer
Engineer

Joined: Sat Jan 06, 2007 6:44 pm
Posts: 16
Hello

The attached patch allows to buy an area of land via the dragging of
the mouse like bulldozing an area. I find this useful for reserving areas
into which cities should no grow.

Raimar


Attachments:
buy_area1.diff [3.94 KiB]
Downloaded 764 times
Top
   
 Post subject:
PostPosted: Sat Jan 06, 2007 9:22 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Aug 22, 2006 1:15 pm
Posts: 158
Location: Australia
thank you!

This has been needed for a long time.


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 12:40 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Sep 20, 2006 11:36 am
Posts: 325
Location: Russia, Moscow
mexicoshanty wrote:
This has been needed for a long time.

Doesn't it was in MiniIN all this long time?

_________________
Image


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 4:03 am 
Offline
Tycoon
Tycoon

Joined: Sat Jun 18, 2005 9:08 pm
Posts: 1141
Location: Here
Quark wrote:
Doesn't it was in MiniIN all this long time?


Ralf Wiggum wrote:
Me fail english? Thats unpossible!
:lol:

_________________
We Am De Best

Host of ThroughTheTube site


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 5:20 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Sep 20, 2006 11:36 am
Posts: 325
Location: Russia, Moscow
Ralf Wiggum wrote:
Me fail english? Thats unpossible!

I never studied English, so please don't blame me for improper word connections :) (Better PM me with right sentence form and some notes why I was wrong)
Or you prefer google translation instead? :)

_________________
Image


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 5:35 am 
Offline
Tycoon
Tycoon

Joined: Sat Jun 18, 2005 9:08 pm
Posts: 1141
Location: Here
Well... the thing is... im not entirely sure myself :?

_________________
We Am De Best



Host of ThroughTheTube site


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 9:00 am 
Offline
Engineer
Engineer

Joined: Sat Jan 06, 2007 6:44 pm
Posts: 16
Quark wrote:
mexicoshanty wrote:
This has been needed for a long time.

Doesn't it was in MiniIN all this long time?


Independent of this: what are the next steps to get this feature into HEAD?

EDIT: Well I just found http://bugs.openttd.org/task/331 :(

Raimar


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 9:45 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1947
Location: Venezia - Italia
this patch is also included in the eyecandy patch because is needed...
it also is multiplayer-proof, to avoid the purchasing of big areas of terrain in multiplayer... so is futile to continue to make other versions, maybe try to fix and make elegant the code of the one in the eyecandy patch

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 10:56 am 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Sep 20, 2006 11:36 am
Posts: 325
Location: Russia, Moscow
rfalke wrote:
EDIT: Well I just found http://bugs.openttd.org/task/331 :(
That patch has bug with it
Code:
+   // loop through the affected tiles
+   BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
+      if (!EnsureNoVehicle(tile2)) return CMD_ERROR;
 
+      if (IsOwnedLandTile(tile2) && IsTileOwner(tile2, _current_player)) {
+         return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT);
+      }
+
+      ret = DoCommand(tile2, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
+      if (CmdFailed(ret)) return CMD_ERROR;
+      cost += ret;
+
+      if (flags & DC_EXEC) {
+         if ((money -= ret) < 0) {
+            _additional_cash_required = ret;
+            return cost - ret;
+         }
+         MakeOwnedLand(tile2, _current_player);
+         MarkTileDirtyByTile(tile2);
+      }
+   } END_TILE_LOOP(tile2, size_x, size_y, tile)
+
    return cost + _price.purchase_land * 10;

You can see, it returns cost needed to clear area plus purchase cost of one tile.
There was another bug in MiniIN (when I was compiling my build), it returns full cost plus cost of one tile.

_________________
Image


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 11:03 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1947
Location: Venezia - Italia
in miniIN it returned the cost minus the cost of one tile
that because if you buy one tile you get the cost of purchasing 2 tiles, so i thought was better to miss a tile when more than one are purchased instead of buy 2 times a single tile
i'm still thinking an elegant solution with no code duplication

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 12:53 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed Sep 20, 2006 11:36 am
Posts: 325
Location: Russia, Moscow
I can't understand what you say :), but in MiniIN that line is executed before cost calculation
Code:
cost = _price.purchase_land*10; //crashes the game
after cost is only added to itself, so returned price is total+1. So when you buy 3 tiles you pay 4x and when you buy 1 tile you pay 2x, so in end is that line
Code:
// END DRAG CODE
   return cost; //buy 3 pay 2, why?
See error?
You always pay 2x when you buy one tile and situation is more worse when you buy land with _patches.advanced_town_handling — you pay one tile by price without patch and then all area by price with patch.

P.S. and what that «crashes the game» comment?
P.P.S. To fix it you need to initialize cost to 0 instead of purchase land cost. Maybe cost was «*=» sometime ago?

_________________
Image


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 3:31 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Apr 24, 2004 10:43 am
Posts: 1947
Location: Venezia - Italia
that is because the patch wasn't finished and was merged with miniIN
previously that line contained a formula to calculate the cost based on the advanced town handling, and crashed the game if the advanced town handling was active, i fixed that but i didn't remove the comment

_________________
ImageImage
ImageImage
ImageImage
newgrf tests, see: newgrf test topic, my patches: Wolf01's Hire Point
Italian TTD Forum
Wiki Page


Top
   
 Post subject:
PostPosted: Sun Jan 07, 2007 4:12 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Feb 06, 2006 11:58 pm
Posts: 340
Currently it looks something like this.
(Was fixed some time ago)

Code:
cost = 0;
BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
         tile_count+=1;
         //test if is possible to buy the tile
         if (!EnsureNoVehicle(tile2)) continue;

         if (IsOwnedLandTile(tile2) && IsTileOwner(tile2, _current_player)) {
            purchased_count+=1;
            continue;
         } else {
            othercost = DoCommand(tile2, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
            if (CmdFailed(othercost)) {
                unclear_count+=1;
               continue;
            } else {
               cost += othercost;
            }
         }
         if (flags & DC_EXEC) {
            MakeOwnedLand(tile2, _current_player, p1);
            MarkTileDirtyByTile(tile2);
         }
         //add cost for tile
         cost += _price.purchase_land*10;
      } END_TILE_LOOP(tile2, size_x, size_y, tile)
//error handling
      if (tile_count == (unclear_count+purchased_count)) {
         if (tile_count == purchased_count) {
             return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT);
         } else {
             return CMD_ERROR;
         }
      }
      return cost;

_________________
Copy & Paste Patch for OTTD
Distant-Joined Stations Patch for OTTD
Eyecandy Patch for OTTD


Top
   
 Post subject:
PostPosted: Wed Apr 25, 2007 1:29 am 
Offline
Engineer
Engineer

Joined: Wed Apr 25, 2007 1:19 am
Posts: 18
Location: Portugal
Rediff against trunk r9715.


Attachments:
buy-area-r9715.patch [4.02 KiB]
Downloaded 256 times
Top
   
 Post subject:
PostPosted: Wed Apr 25, 2007 6:27 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Sep 20, 2004 10:45 pm
Posts: 11470
Location: Black Mesa Research Facility - New Mexico
Wow you are on fire aren't you? :P

Great work Micomico! Also with the other rediff. :)

_________________
Image
Authority is something you deserve, not something you impose. -Wile E. Coyote

Closet troll that got locked inside and accidentally left the keys outside.


Top
   
 Post subject:
PostPosted: Mon May 28, 2007 5:33 pm 
Offline
Engineer
Engineer

Joined: Sun May 06, 2007 5:49 pm
Posts: 34
There are several changes in the code so the patch doesn't work.
Here an update:

Edit 19. June 2007: update to r10220


Attachments:
buy_an_area_r10220.patch [4.43 KiB]
Downloaded 274 times
File comment: Win32 executable
buy_an_area_r10215.7z [904.1 KiB]
Downloaded 186 times
Top
   
PostPosted: Thu Oct 25, 2007 9:23 pm 
Offline
Route Supervisor
Route Supervisor
User avatar

Joined: Sun Dec 03, 2006 1:22 pm
Posts: 472
Location: Czech Republic
patch dont work for me :|
can anyone update it please?

_________________
My patches: Day length (new concept), Conditional loading, Auto separation, Unload all adds Leave empty, Better statue placement (in trunk)
My abandoned patches: Speed limits for RVs, Day length (old concept)


Top
   
PostPosted: Fri Oct 26, 2007 4:03 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
How dont[sic] it work?

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
PostPosted: Fri Oct 26, 2007 10:13 am 
Offline
Route Supervisor
Route Supervisor
User avatar

Joined: Sun Dec 03, 2006 1:22 pm
Posts: 472
Location: Czech Republic
you can select what area you want to buy, but when you drop left mouse buttom, nothink happend

_________________
My patches: Day length (new concept), Conditional loading, Auto separation, Unload all adds Leave empty, Better statue placement (in trunk)
My abandoned patches: Speed limits for RVs, Day length (old concept)


Top
   
PostPosted: Fri Oct 26, 2007 4:26 pm 
Offline
Chairman
Chairman
User avatar

Joined: Fri Dec 29, 2006 2:05 pm
Posts: 847
Skype: chirea_mircea
Location: Craiova, Romania
Are you sure you applied it on r10220?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 75 posts ]  Go to page 1 2 3 4 Next

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], NewGRF and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.