(svn r294) -Fix: autorail always builds rail, instead of occasional rail removal (on pressing hotkey after pressing 'bulldozer')
authordarkvater
Sat, 18 Sep 2004 16:40:06 +0000
changeset 288 6bd97cdf1652
parent 287 ca9584af45a0
child 289 1e1102dd2a62
(svn r294) -Fix: autorail always builds rail, instead of occasional rail removal (on pressing hotkey after pressing 'bulldozer')
-Fix: network fixes (Tron)
-Some textfile changes, mainly URL's
docs/console.txt
network.c
rail_gui.c
readme.txt
train_cmd.c
--- a/docs/console.txt	Sat Sep 18 16:36:14 2004 +0000
+++ b/docs/console.txt	Sat Sep 18 16:40:06 2004 +0000
@@ -1,6 +1,6 @@
 OPENTTD INGAME CONSOLE DOCUMENTATION
 ====================================
-http://openttd.rulez.org/wiki2/index.php/OpenTTDDevBlackBook
+http://wiki.openttd.org/index.php/OpenTTDDevBlackBook
 for detailed information
 
 HOTKEY: BACKQUOTE (aka tilde, the key left to "1")
--- a/network.c	Sat Sep 18 16:36:14 2004 +0000
+++ b/network.c	Sat Sep 18 16:40:06 2004 +0000
@@ -951,14 +951,13 @@
 void NetworkSendReadyPacket()
 {
 	if ((!_network_ready_sent) && (_frame_counter + _network_ready_ahead >= _frame_counter_max)) {
-		ReadyPacket *rp	= malloc(sizeof(rp));
-		ClientState *c	= _clients;
+		ReadyPacket rp;
 
 		DEBUG(net,1) ("NET: %i] ready packet sent", _frame_counter);
 
-		rp->packet_type = PACKET_TYPE_READY;
-		rp->packet_length = sizeof(rp);
-		SendBytes(c, rp, sizeof(rp));
+		rp.packet_type = PACKET_TYPE_READY;
+		rp.packet_length = sizeof(rp);
+		SendBytes(_clients, &rp, sizeof(rp));
 		_network_ready_sent = true;
 	}
 }
@@ -1911,20 +1910,18 @@
 void NetworkGameFillDefaults()
 {
 	NetworkGameInfo * game = &_network_game;
-#if defined(WITH_REV)
-	extern char _openttd_revision[];
-#endif
+	#if defined(WITH_REV)
+		extern char _openttd_revision[];
+	#else
+		const char _openttd_revision[] = "norev000";
+	#endif
 
 	DEBUG(net, 4) ("[NET][G-Info] setting defaults");
 
-	ttd_strlcpy(game->server_name,"OpenTTD Game",13);
+	ttd_strlcpy(game->server_name, "OpenTTD Game", sizeof(game->server_name));
 	game->game_password[0]='\0';
 	game->map_name[0]='\0';
-#if defined(WITH_REV)
-	ttd_strlcpy(game->server_revision,_openttd_revision,strlen(_openttd_revision));
-#else
-	ttd_strlcpy(game->server_revision,"norev000",strlen("norev000"));
-#endif
+	ttd_strlcpy(game->server_revision, _openttd_revision, sizeof(game->server_revision));
 	game->game_date=0;
 
 	game->map_height=0;
--- a/rail_gui.c	Sat Sep 18 16:36:14 2004 +0000
+++ b/rail_gui.c	Sat Sep 18 16:40:06 2004 +0000
@@ -810,6 +810,7 @@
 		w = AllocateWindowDesc(_build_rr_desc[index]);
 	}
 
+	_remove_button_clicked = false;
 	if (w != NULL && button >= 0) _build_railroad_button_proc[button](w);
 }
 
--- a/readme.txt	Sat Sep 18 16:36:14 2004 +0000
+++ b/readme.txt	Sat Sep 18 16:40:06 2004 +0000
@@ -111,6 +111,7 @@
 
 * Use Ctrl to place presignals
 * Ctrl-d toggles double mode on win32
+* Ingame console. More information at http://wiki.openttd.org/index.php/OpenTTDDevBlackBook
 
 
 6.0) Configuration File:
--- a/train_cmd.c	Sat Sep 18 16:36:14 2004 +0000
+++ b/train_cmd.c	Sat Sep 18 16:40:06 2004 +0000
@@ -2253,8 +2253,8 @@
 
 	do {
 		//I need to buffer the train direction
-		if (!v->u.rail.track & 0x40)
-			v->direction = (v->direction + _random_dir_change[Random()&3]) & 7;
+		if (!(v->u.rail.track & 0x40))
+			v->direction = (v->direction + _random_dir_change[InteractiveRandom()&3]) & 7;
 		if (!(v->vehstatus & VS_HIDDEN)) {
 			BeginVehicleMove(v);
 			UpdateTrainDeltaXY(v, v->direction);
@@ -2274,13 +2274,13 @@
 		CreateEffectVehicleRel(v, 4, 4, 8, EV_CRASHED_SMOKE);
 	}
 
-	if (state <= 200 && (uint16)(r=Random()) <= 0x2492) {
+	if (state <= 200 && (uint16)(r=InteractiveRandom()) <= 0x2492) {
 		index = (r * 10 >> 16);
 
 		u = v;
 		do {
 			if (--index < 0) {
-				r = Random();
+				r = InteractiveRandom();
 
 				CreateEffectVehicleRel(u,
 					2 + ((r>>8)&7),